Hotaru Docs


About the Title Tags

Title Tags

The title that displays at the top of your browser is determined by the getTitle function called from the header.php file in your theme:

<title><?php echo $h->getTitle(); ?></title>

1. If there is a $hotaru->pageTitle, show it and append the site name, e.g.

  • Man wins the lottery << Hotaru CMS (post title)
  • Activities << Hotaru CMS (category name)
  • Bingo << Hotaru CMS (tag)


2. If $h->pageName is not equal to $h->home, make it look pretty and append the site title, e.g.

  • Profile << Hotaru CMS
  • Page Settings << Hotaru CMS

Customizing title tags

If you'd like to change how titles are displayed, there are two parameters you can pass to the getTitle function:

$h->getTitle(' &raquo; '); // replaces the default delimiter (&laquo)
$h->getTitle('', true); // enables "raw" mode which returns ONLY the title with no site name attached
$h->getTitle(' - ', true) // example using both paramters>

Note to plugin developers: Instead of hard-coding delimiters into your page titles, use the text [delimiter]. The getTitle function will replace that text with the user's choice of delimiter.

Theme tricks

Let's say you've made a template called tos.php which you areusing for your Terms of Service. Because the file isn't generated by a plugin, it has no $h->pageTitle, so Hotaru will simply display this as the title:

  • Tos << Hotaru CMS

To make that prettier, at the top of your theme's index.php file, after the comment block, do this:

if ($h->pageName == 'tos') { $h->pageTitle = 'Terms of Service'; }

and that will give you this:

  • Terms of Service << Hotaru CMS
Getting StartedDesign and LayoutPlugin DevelopmentAdvanced TopicsFunction ReferenceTroubleshooting