/** * Preparing global layout * * @return $this */ protected function _prepareLayout() { $post = $this->getPost(); $this->_addBreadcrumbs($post); $this->pageConfig->addBodyClass('blog-post-' . $post->getIdentifier()); $this->pageConfig->getTitle()->set($post->getTitle()); $this->pageConfig->setKeywords($post->getMetaKeywords()); $this->pageConfig->setDescription($post->getMetaDescription()); return parent::_prepareLayout(); }
/** * Preparing global layout * * @return $this */ protected function _prepareLayout() { $post = $this->getPost(); if ($post) { $this->_addBreadcrumbs($post); $this->pageConfig->addBodyClass('blog-post-' . $post->getIdentifier()); $this->pageConfig->getTitle()->set($post->getMetaTitle()); $this->pageConfig->setKeywords($post->getMetaKeywords()); $this->pageConfig->setDescription($post->getMetaDescription()); $this->pageConfig->addRemotePageAsset($post->getPostUrl(), 'canonical', ['attributes' => ['rel' => 'canonical']]); } return parent::_prepareLayout(); }