Add page name / suffix to website title
If you want search engine results to show your page titles like this:
Your article title which is usually longer | Your Page
The page title appears in browser title bars and search engines. There are extensions available for managing page title suffixes/prefixes and adding your desired content before or after your page titles. But, there is a really simple way of adding your page name to page titles:
- Log in to your sites administration panel.
- Go to Site -> Global Configuration
- On the right locate SEO Settings
- Change the value of Include Page Name in Page Titles to Before or After, which you prefer.
- Save and refresh your website view
The same thing can be achieved using a few lines of code in your template index.php file, shis is useful when you'd like to have your own separator to the titles. Here's how:
- Open index.php from your template folder for editing. You can do it even from the Joomla! administrator panel going through Extensions -> Templates -> Templates and selecting your template (be sure to set the file writable on your server, else you'll not be able to edit it).
- Add the following lines of code to right before the head closing tag </head>
/* start code */
<?php // let's change the page title to TITLE | SITENAME
$document =& JFactory::getDocument();
$document->setTitle($document->title . " | Your Desired Page Title Here ");
/* end code*/
* note that in this example | is used as a separator. You can use whatever you like instead of it.
- Save and refresh your page.