public function calculateSeo(SeoEvent $event)
 {
     $seo = $event->getSeo();
     if (!$seo->hasMeta('property', 'og:site_name')) {
         $company = $this->settings->load('company');
         $seo->addMetaProperty('og:site_name', $company['name']);
     }
 }
Exemple #2
0
 public function calculateSeo(SeoEvent $event)
 {
     $seo = $event->getSeo();
     $request = $event->getRequest();
     if ($request !== null) {
         $seo->addHtmlAttr('lang', $request->getLocale());
     }
 }
 /**
  * {@inheritdoc}
  */
 public function calculateSeo(SeoEvent $event)
 {
     if ($this->request === null || !$this->request->attributes->has('_seo')) {
         return;
     }
     $requestSeo = $this->request->attributes->get('_seo');
     $seo = $event->getSeo();
     $seo->merge($requestSeo, true);
 }
 public function calculateSeo(SeoEvent $event)
 {
     $seo = $event->getSeo();
     $subject = $seo->getSubject();
     $preference = $this->findPreference($subject);
     // No preference just return
     if ($preference === null) {
         return;
     }
     $title = $this->calculateProperty($subject, $preference->getTitle());
     $description = $this->calculateProperty($subject, $preference->getDescription());
     $seo->merge(['title' => $title, 'description' => $description]);
 }
Exemple #5
0
 public function calculateSeo(SeoEvent $event)
 {
     $seo = $event->getSeo();
     $subject = $seo->getSubject();
     if (!$subject instanceof PostInterface) {
         return;
     }
     /*
      * Add OpenGraph Image
      */
     if (($image = $subject->getImage()) !== null) {
         $path = $event->getRequest()->getUriForPath($image->getWebPath());
         $seo->addMetaProperty('og:image', $path);
     }
 }
Exemple #6
0
 public function calculateSeo(SeoEvent $event)
 {
     $seo = $event->getSeo();
     /*
      * Trim title
      */
     $title = SeoTools::plain($seo->getTitle(), $this->maxTitleLength);
     $seo->setTitle($title);
     /*
      * Trim meta description
      */
     if ($seo->hasMeta('name', 'description')) {
         $description = SeoTools::plain($seo->getMetas('name', 'description'), $this->maxDescriptionLength);
         $seo->addMetaName('description', $description);
     }
 }
Exemple #7
0
 public function calculateSeo(SeoEvent $event)
 {
     $seo = $event->getSeo();
     /*
      * Set meta description from seo description variable
      */
     if (!$seo->hasMeta('name', 'description')) {
         $seo->addMetaName('description', $seo->getDescription());
     }
     /*
      * Set robots from index / follow variables
      */
     if (!$seo->hasMeta('name', 'robots')) {
         $index = $seo->getIndex() ? 'index' : 'noindex';
         $follow = $seo->getFollow() ? 'follow' : 'nofollow';
         $seo->addMetaName('robots', sprintf('%s, %s', $index, $follow));
     }
 }
 public function calculateSeo(SeoEvent $event)
 {
     $seo = $event->getSeo();
     $request = $event->getRequest();
     /*
      * Add current location
      */
     if ($request !== null) {
         $seo->addMetaProperty('og:url', $request->getUri());
     }
     /*
      * OpenGraph Title
      */
     if (!$seo->hasMeta('property', 'og:title')) {
         $seo->addMetaProperty('og:title', $seo->getTitle());
     }
     /*
      * OpenGraph Description
      */
     if (!$seo->hasMeta('property', 'og:description') && $seo->hasMeta('name', 'description')) {
         $seo->addMetaProperty('og:description', $seo->getMetas('name', 'description'));
     }
 }