Section _index.md breaks breadcrumb

Not sure if this is intended or unintended behaviour regarding the breadcrumb and the use of _index.md to customise a listing page

If you create this folder structure:

├── archetypes
│   └── default.md
├── config.yml
├── content
│   ├── posts
│   │   ├── first_post.md
│   │   ├── second_post.md

When you view any of your posts, the breadcrumb (in either Post page) will correctly display like this:
Home >> Posts

However if you add a _index.md to the posts folder to add custom text above the listing of the posts like this

├── archetypes
│   └── default.md
├── config.yml
├── content
│   ├── posts
│   │   ├── _index.md
│   │   ├── first_post.md
│   │   ├── second_post.md

then the breadcrumb breaks and renders as
Home

Notice that the >> Posts link is no longer rendered anymore

Why would you want to use the _index.md? Because it is a simple way of adding some text above the listing of the posts, eg

We would need to see the code that is generating the breadcrumb.

See https://discourse.gohugo.io/t/requesting-help/9132.

Let us see your code

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

In creating a new site to demo the problem, I actually fixed it by discovering that the issues was caused by a missing title attribute in the front matter of _index.md in the /posts folder

Adding the following to the file

---
title: Posts
---

fixed the issue.

The demo site that shows this working correctly now is available here
my-hugo-demo-site

I guess I still have a lot to learn about Hugo!

Excellent. This is one of the benefits of creating a minimal reproducible example; it can quickly expose the underlying problem. Well done!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.