Skip to content

Commit

Permalink
check if meta tags not empty before setting
Browse files Browse the repository at this point in the history
  • Loading branch information
eluhr committed Jan 8, 2020
1 parent 0ca156a commit aaeb506
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions controllers/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,13 @@ public function actionPage($pageId)
$this->view->title = $page->page_title ?: $page->name;

// Register default SEO meta tags
$this->view->registerMetaTag(['name' => 'keywords', 'content' => $page->default_meta_keywords],'meta-keywords');
$this->view->registerMetaTag(['name' => 'description', 'content' => $page->default_meta_description], 'meta-description');
if (!empty($page->default_meta_keywords)) {
$this->view->registerMetaTag(['name' => 'keywords', 'content' => $page->default_meta_keywords],'meta-keywords');
}

if (!empty($page->default_meta_description)) {
$this->view->registerMetaTag(['name' => 'description', 'content' => $page->default_meta_description], 'meta-description');
}

// Render view
return $this->render($page->view, ['page' => $page]);
Expand Down

0 comments on commit aaeb506

Please sign in to comment.