Answers.Body: <p>The <code>title</code> var can be set in the child templates, that way you can fine-tune it for each section of your site.</p>
  
  <p>Take a look at these default templates:</p>
  
  <p><strong>news/index.html:</strong></p>
  
  <pre><code>{% set title = "News" %}
  </code></pre>
  
  <p><strong>news/_entry.html:</strong></p>
  
  <pre><code>{% set title = entry.title %}
  </code></pre>
  
  <p><strong>_layout.html:</strong></p>
  
  <p>The main layout just checks if it has been defined or not:</p>
  
  <pre><code>{% if title is defined %}{{ title }} - {% endif %}{{ siteName }}
  </code></pre>
  
  <p>.</p>
  
  <p>P.S. Embed templates might be confusing at first, but are really great, <a href="http://twig.sensiolabs.org/doc/tags/embed.html">check out the docs.</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-04T17:02:15.767Z
Answers.LastActivityDate: 2014-07-04T17:02:15.767Z
Answers.UserDisplayName: Victor
Body: <p>Inside the default template that comes installed with Craft, the title of a page is set as:</p>
  
  <pre><code>&lt;title&gt;{% if title is defined %}{{ title }} - {% endif %}{{ siteName }}&lt;/title&gt;
  </code></pre>
  
  <p>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.</p>
  
  <p>I've tried to use the {{ entry.title }} variable instead, however in that case the title of the homepage is rendered as 'Homepage - {{ siteName }}'.</p>
  
  <p>What's the best way to achieve the following page titles for the different sections?</p>
  
  <pre><code>Homepage: {{ siteName }}
  Page: {{ title }} - {{ siteName }}
  Entry: {{ entry.title }} - {{ siteName }}
  </code></pre>
  
Tags: <templating><titles>
Title: How do I adjust the page title for different Section and Entry pages?
ThreadText: # How do I adjust the page title for different Section and Entry pages?
  
  (Asked by: username_0 on 2014-07-04)
  
  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 }}
  
  ```
  
  **Tags:** templating, titles
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-07-04. Score: 11 | Accepted answer
  
  The `title` var can be set in the child templates, that way you can fine-tune it for each section of your site.
  
  Take a look at these default templates:
  
  **news/index.html:**
  
  ```
  {% set title = "News" %}
  
  ```
  
  **news/\_entry.html:**
  
  ```
  {% set title = entry.title %}
  
  ```
  
  **\_layout.html:**
  
  The main layout just checks if it has been defined or not:
  
  ```
  {% if title is defined %}{{ title }} - {% endif %}{{ siteName }}
  
  ```
  
  .
  
  P.S. Embed templates might be confusing at first, but are really great, [check out the docs.](http://twig.sensiolabs.org/doc/tags/embed.html)
  
  
  ---
  
  