Breadcrumbs for category pages I'm a Craft first-timer building a simple blog site. I want to include breadcrumbs at the top of each page like so:


  siteurl.com: [Blog]
  
  siteurl.com/category/example-category: [Blog > Example Category]
  
  siteurl.com/post/2015/entry-title: [Blog > Entry Title]


I've found this snippet which correctly outputs the breadcrumb for the entry permalink page:

&lt;ul class="breadcrumbs"&gt;
    &lt;li&gt;&lt;a href="{{ siteUrl }}"&gt;Blog&lt;/a&gt;&lt;/li&gt;
    {% if craft.request.segments %}
        {% for crumb in entry.getAncestors() %}
           &lt;li&gt;{{ crumb.getLink() }}&lt;/li&gt;
        {% endfor %}
        &lt;li&gt;{{ entry.title() }}&lt;/a&gt;&lt;/li&gt;
    {% endif %}
&lt;/ul&gt;


But I also need something that will include a crumb for when the visitor is on a category page.

So far, my templates are structured like so:

templates/
 | index.html
 | _layout.html
 | posts/
    | index.html
    | category.html
    | _entry.html


Where the breadcrumb snippet is included in '_layout.html'.

In EE, I would just check my segments and use Low Seg2Cat to grab the category title. Is there an equivalent to this process in Craft? Or is it handled completely differently?
If your categories are only one level deep, you could hard-code the breadcrumbs into the category template:

{% block breadcrumb %}
  &lt;ul class="breadcrumbs"&gt;
    &lt;li&gt;&lt;a href="{{ siteUrl }}"&gt;Blog&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;{{ category.title }}&lt;/li&gt;
  &lt;/ul&gt;
{% endblock %}


In _layout.html you would have:

{% block breadcrumb %}
  &lt;ul class="breadcrumbs"&gt;
    &lt;li&gt;&lt;a href="{{ siteUrl }}"&gt;Blog&lt;/a&gt;&lt;/li&gt;
    {% if craft.request.segments %}
      {% for crumb in entry.getAncestors() %}
        &lt;li&gt;{{ crumb.getLink() }}&lt;/li&gt;
      {% endfor %}
      &lt;li&gt;{{ entry.title() }}&lt;/a&gt;&lt;/li&gt;
    {% endif %}
  &lt;/ul&gt;
{% endblock %}


Haven't tried this myself, but I think it would work - the category template would override the layout. 

Of course, if you have multiple levels of categories, the intermediate levels won't be included, so it's not an ideal solution.