Skip to content

Commit

Permalink
Fixes #19, making sure to use the custom page title
Browse files Browse the repository at this point in the history
  • Loading branch information
Anderson Grudtner Martins committed Mar 17, 2015
1 parent 7e2b1d1 commit e633692
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/site/views/html/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,20 @@ protected function _prepareDocument()
$app = JFactory::getApplication();
$pathway = $app->getPathway();
$menus = $app->getMenu();
$title = null;

$title = $this->item->title;

// Because the application sets a default page title, we need to get it from the menu item itself
if ($menu = $menus->getActive()) {
if (isset($menu->query['view']) && isset($menu->query['id'])) {

if ($menu->query['view'] == 'html' && $menu->query['id'] == $this->item->id) {
$title = $menu->title;
$title = $menu->params->get('page_title', '');

if (empty($title)) {
$title = $menu->title;
}

if (empty($title)) {
$title = $app->getCfg('sitename');
} else if ($app->getCfg('sitename_pagetitles', 0) == 1) {
Expand All @@ -152,6 +158,7 @@ protected function _prepareDocument()
}
}
}

$this->document->setTitle($title);

if ($app->getCfg('MetaTitle') == '1') {
Expand Down

0 comments on commit e633692

Please sign in to comment.