Answers.Body: <p>You can use something like this in your main layout template. You'll need to add a filter after "segments" to get the URI segment you want, e.g.: <code>|first</code> or <code>|last</code>, and you'll also need to <a href="https://docs.craftcms.com/v3/dev/filters.html#replace" rel="nofollow noreferrer">|replace</a> any hyphens and then <a href="https://twig.symfony.com/doc/2.x/filters/capitalize.html" rel="nofollow noreferrer">|capitalize</a> the first letter of the result.</p>
  
  <pre><code>{% set myUri = craft.app.request.segments %}
  
  &lt;title&gt;{{ myUri }}&lt;/title&gt;
  </code></pre>
  
  <p>For more on segments: <a href="https://docs.craftcms.com/v3/changes-in-craft-3.html#template-functions" rel="nofollow noreferrer">https://docs.craftcms.com/v3/changes-in-craft-3.html#template-functions</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-10T16:24:55.620Z
Answers.LastActivityDate: 2019-02-10T16:24:55.620Z
Answers.UserDisplayName: Jon Weedin
Body: <p>I am working on my SEO and I am getting a duplicate title in Craft.
  I want to make a custom title using the URI segment in using PHP.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-14T02:43:58.483Z
Comments.Text: Can you give an example, using a URI and then the Title you would like to see?
Comments.UserDisplayName: Roi Agneta
Tags: <craft3><php>
Title: Custom title using URI segment
ThreadText: # Custom title using URI segment
  
  (Asked by: username_0 on 2019-02-10)
  
  I am working on my SEO and I am getting a duplicate title in Craft.
  I want to make a custom title using the URI segment in using PHP.
  
  **Tags:** craft3, php
  
  > **Comments:**
  > **username_1**: Can you give an example, using a URI and then the Title you would like to see?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2019-02-10. Score: 1
  
  You can use something like this in your main layout template. You'll need to add a filter after "segments" to get the URI segment you want, e.g.: `|first` or `|last`, and you'll also need to [|replace](https://docs.craftcms.com/v3/dev/filters.html#replace) any hyphens and then [|capitalize](https://twig.symfony.com/doc/2.x/filters/capitalize.html) the first letter of the result.
  
  ```
  {% set myUri = craft.app.request.segments %}
  
  <title>{{ myUri }}</title>
  
  ```
  
  For more on segments: <https://docs.craftcms.com/v3/changes-in-craft-3.html#template-functions>
  
  
  ---
  
  