From: Marcel Werk Date: Tue, 28 Jun 2016 21:05:39 +0000 (+0200) Subject: Added metag tags for cms pages X-Git-Tag: 3.0.0_Beta_1~1321 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=98007c9aee00f294f2717ae240c4faab709c733d;p=GitHub%2FWoltLab%2FWCF.git Added metag tags for cms pages --- diff --git a/wcfsetup/install/files/lib/page/CmsPage.class.php b/wcfsetup/install/files/lib/page/CmsPage.class.php index 80f2e28f67..7232fd0c9d 100644 --- a/wcfsetup/install/files/lib/page/CmsPage.class.php +++ b/wcfsetup/install/files/lib/page/CmsPage.class.php @@ -3,6 +3,7 @@ namespace wcf\page; use wcf\data\page\Page; use wcf\system\exception\IllegalLinkException; use wcf\system\language\LanguageFactory; +use wcf\system\MetaTagHandler; use wcf\system\request\LinkHandler; use wcf\system\request\RequestHandler; use wcf\system\WCF; @@ -80,6 +81,24 @@ class CmsPage extends AbstractPage { } } + /** + * @inheritDoc + */ + public function readData() { + parent::readData(); + + // add meta/og tags + MetaTagHandler::getInstance()->addTag('og:title', 'og:title', $this->content['title'] . ' - ' . WCF::getLanguage()->get(PAGE_TITLE), true); + MetaTagHandler::getInstance()->addTag('og:url', 'og:url', $this->canonicalURL, true); + MetaTagHandler::getInstance()->addTag('og:type', 'og:type', 'website', true); + if ($this->content['metaDescription']) { + MetaTagHandler::getInstance()->addTag('og:description', 'og:description', $this->content['metaDescription'], true); + } + if ($this->content['metaKeywords']) { + MetaTagHandler::getInstance()->addTag('keywords', 'keywords', $this->content['metaKeywords']); + } + } + /** * @inheritDoc */