Inside the default template that comes installed with Craft, the title of a page is set as:
<title>{% if title is defined %}{{ title }} - {% endif %}{{ siteName }}</title>
This works perfectly for the homepage and on pages where the {{ title }} variable is set. However for individual entries inside a channel, only the site name is used for the title.
I've tried to use the {{ entry.title }} variable instead, however in that case the title of the homepage is rendered as 'Homepage - {{ siteName }}'.
What's the best way to achieve the following page titles for the different sections?
Homepage: {{ siteName }}
Page: {{ title }} - {{ siteName }}
Entry: {{ entry.title }} - {{ siteName }}