Skip to content

Commit

Permalink
Use the page name if the page has no SEO titel
Browse files Browse the repository at this point in the history
  • Loading branch information
core23 committed May 28, 2016
1 parent 02ca37f commit 47c0468
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions Page/Service/DefaultPageService.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ protected function updateSeoPage(PageInterface $page)
return;
}

if ($page->getTitle()) {
$this->seoPage->setTitle($page->getTitle() ?: $page->getName());
}
$this->seoPage->setTitle($page->getTitle() ?: $page->getName());

if ($page->getMetaDescription()) {
$this->seoPage->addMeta('name', 'description', $page->getMetaDescription());
Expand Down
2 changes: 1 addition & 1 deletion Tests/Page/Service/DefaultPageServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function testExecute()

// mock a page instance
$page = $this->getMock('Sonata\PageBundle\Model\PageInterface');
$page->expects($this->exactly(2))->method('getTitle')->will($this->returnValue('page title'));
$page->expects($this->any())->method('getTitle')->will($this->returnValue('page title'));
$page->expects($this->atLeastOnce())->method('getMetaDescription')->will($this->returnValue('page meta description'));
$page->expects($this->atLeastOnce())->method('getMetaKeyword')->will($this->returnValue('page meta keywords'));
$page->expects($this->once())->method('getTemplateCode')->will($this->returnValue('template code'));
Expand Down

0 comments on commit 47c0468

Please sign in to comment.