Пример #1
0
 /**
  * @inheritdoc
  */
 protected function setMetaStatements()
 {
     parent::setMetaStatements();
     // Vorherige und nächste Seite für Suchmaschinen und Prefetching propagieren
     if ($this->request->getArea() !== AreaEnum::AREA_ADMIN) {
         $path = ($this->request->getArea() === AreaEnum::AREA_ADMIN ? 'acp/' : '') . $this->request->getUriWithoutPages();
         $link = $this->router->route($path);
         if ($this->currentPage - 1 > 0) {
             // Seitenangabe in der Seitenbeschreibung ab Seite 2 angeben
             $this->metaStatements->setDescriptionPostfix($this->translator->t('system', 'page_x', ['%page%' => $this->currentPage]));
             $this->metaStatements->setPreviousPage($link . 'page_' . ($this->currentPage - 1) . '/');
         }
         if ($this->currentPage + 1 <= $this->totalPages) {
             $this->metaStatements->setNextPage($link . 'page_' . ($this->currentPage + 1) . '/');
         }
         if ($this->request->getParameters()->get('page', 0) === 1) {
             $this->metaStatements->setCanonicalUri($link);
         }
     }
 }
Пример #2
0
 /**
  * @param int $cat
  */
 protected function addBreadcrumbStep($cat)
 {
     if ($cat !== 0 && $this->newsSettings['category_in_breadcrumb'] == 1) {
         if ($this->metaStatements instanceof MetaStatements) {
             $this->metaStatements->setCanonicalUri($this->router->route('news'));
         }
         $this->breadcrumb->append($this->translator->t('news', 'news'), 'news');
         $category = $this->categoryRepository->getTitleById($cat);
         if (!empty($category)) {
             $this->breadcrumb->append($category);
         }
     }
 }
 /**
  * If there is an URI alias available, set the alias as the canonical URI
  *
  * @param \ACP3\Core\Application\Event\ControllerActionBeforeDispatchEvent $event
  */
 public function onBeforeDispatch(ControllerActionBeforeDispatchEvent $event)
 {
     if ($this->isInFrontend($event) && $this->uriAliasExists()) {
         $this->metaStatements->setCanonicalUri($this->router->route($this->request->getQuery()));
     }
 }