Skip to content

Commit

Permalink
Merge pull request #40 from dmstr/feature/keys-for-meta-tags
Browse files Browse the repository at this point in the history
check if meta tags not empty before setting them
  • Loading branch information
eluhr authored Jan 8, 2020
2 parents 0ca156a + aaeb506 commit 1687c1b
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 1687c1b

Please sign in to comment.