- Provide a getter to get the canonical url for the current request. - Update the RequestContext with the scheme/host override from the config. Note: Updating the RequestContext also applies to the UrlGenerator.
Author: Carson Full (carsonfull@gmail.com)
Inheritance: implements Symfony\Component\EventDispatcher\EventSubscriberInterface
Example #1
0
 /**
  * Add base snippets to the response.
  */
 protected function addSnippets()
 {
     $generatorSnippet = (new Snippet())->setLocation(Target::END_OF_HEAD)->setCallback('<meta name="generator" content="Bolt">');
     $this->queue->add($generatorSnippet);
     $canonicalUrl = $this->canonical->getUrl();
     $canonicalSnippet = (new Snippet())->setLocation(Target::END_OF_HEAD)->setCallback($this->encode('<link rel="canonical" href="%s">', $canonicalUrl));
     $this->queue->add($canonicalSnippet);
     if ($favicon = $this->config->get('general/favicon')) {
         $faviconUrl = $this->packages->getUrl($favicon, 'theme');
         $faviconSnippet = (new Snippet())->setLocation(Target::END_OF_HEAD)->setCallback($this->encode('<link rel="shortcut icon" href="%s">', $faviconUrl));
         $this->queue->add($faviconSnippet);
     }
 }