Answers.Body: <p>If your site is mixture of singles, structures and channels then there is no easy way to get the entry titles and or uris from the segments alone. You would have to add some logic based on your known site structure. And even then, you might need to make a lot of requests to retrieve the data. You would likely need to do a combination of static logic, looking up titles and uris based on section/handle, and looping through ancestors within a structure.</p>
  
  <p>You could potentially use the segments themselves, if you where confident that the slugs always matched the titles (or were close enough), and that the uri's where all valid.</p>
  
  <pre><code>{% set segmentUri = "/" %}
  {% for segment in craft.request.segments %}
      {% set segmentUri = segmentUri ~ "/" ~ segment %}
      &lt;a href="segmentUri"&gt;{{ segment|replace('-',' ')|ucwords }}
  {% endfor %}
  </code></pre>
  
  <p>There is also another technique that involves defining the breadcrumb using an entries field on the entry itself that you might consider — which is described in the documentation on <a href="http://buildwithcraft.com/help/breadcrumbs" rel="nofollow">How to create Breadcrumbs</a>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-20T05:37:51.833Z
Answers.LastActivityDate: 2015-01-20T06:04:57.760Z
Answers.LastEditDate: 2015-01-20T06:04:57.760Z
Answers.UserDisplayName: Douglas McDonald
Body: <p>Is it possible to get an entry title and URI from a segment? e.g. If segment 1 has a value of 'about', I'd want to output an entry title of 'About Us', and a URI of 'mysite.com/about', and so on for other segments.</p>
  
  <p>I'm trying to code up a breadcrumb menu, and my site has a mixture of Singles, Structures and Channels.</p>
  
  <p>I have the following _includes/nav_breadcrumb.html template, but I'm hard-coding everything at the moment (and only have it one level deep) so it's not going to be sustainable to keep this up-to-date on anything but the smallest of static sites, hence why I'm wondering about being able to pull in entry details via the segments. Thanks for any help with this.</p>
  
  <pre><code>&lt;a href="{{ siteUrl }}"&gt;Home&lt;/a&gt; &amp;raquo;
  
  {% if craft.request.getSegment(1) == 'about' %}
    &lt;a href="{{ siteUrl }}about"&gt;About&lt;/a&gt;
  
  {% elseif craft.request.getSegment(1) == 'news' %}
    &lt;a href="{{ siteUrl }}news"&gt;News&lt;/a&gt;
  
  {% elseif craft.request.getSegment(1) == 'contact' %}
    &lt;a href="{{ siteUrl }}contact"&gt;Contact&lt;/a&gt;
  
  {% endif %}
  </code></pre>
  
Tags: <templating><navigation><segments>
Title: How to get an entry title and URI from a segment in order to create a breadcrumb navigation
ThreadText: # How to get an entry title and URI from a segment in order to create a breadcrumb navigation
  
  (Asked by: username_0 on 2015-01-20)
  
  Is it possible to get an entry title and URI from a segment? e.g. If segment 1 has a value of 'about', I'd want to output an entry title of 'About Us', and a URI of 'mysite.com/about', and so on for other segments.
  
  I'm trying to code up a breadcrumb menu, and my site has a mixture of Singles, Structures and Channels.
  
  I have the following \_includes/nav\_breadcrumb.html template, but I'm hard-coding everything at the moment (and only have it one level deep) so it's not going to be sustainable to keep this up-to-date on anything but the smallest of static sites, hence why I'm wondering about being able to pull in entry details via the segments. Thanks for any help with this.
  
  ```
  <a href="{{ siteUrl }}">Home</a> &raquo;
  
  {% if craft.request.getSegment(1) == 'about' %}
    <a href="{{ siteUrl }}about">About</a>
  
  {% elseif craft.request.getSegment(1) == 'news' %}
    <a href="{{ siteUrl }}news">News</a>
  
  {% elseif craft.request.getSegment(1) == 'contact' %}
    <a href="{{ siteUrl }}contact">Contact</a>
  
  {% endif %}
  
  ```
  
  **Tags:** templating, navigation, segments
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-01-20. Score: 3 | Accepted answer
  
  If your site is mixture of singles, structures and channels then there is no easy way to get the entry titles and or uris from the segments alone. You would have to add some logic based on your known site structure. And even then, you might need to make a lot of requests to retrieve the data. You would likely need to do a combination of static logic, looking up titles and uris based on section/handle, and looping through ancestors within a structure.
  
  You could potentially use the segments themselves, if you where confident that the slugs always matched the titles (or were close enough), and that the uri's where all valid.
  
  ```
  {% set segmentUri = "/" %}
  {% for segment in craft.request.segments %}
      {% set segmentUri = segmentUri ~ "/" ~ segment %}
      <a href="segmentUri">{{ segment|replace('-',' ')|ucwords }}
  {% endfor %}
  
  ```
  
  There is also another technique that involves defining the breadcrumb using an entries field on the entry itself that you might consider — which is described in the documentation on [How to create Breadcrumbs](http://buildwithcraft.com/help/breadcrumbs).
  
  
  ---
  
  