Subpages without _index.md file

I don’t want to display the list page for the about. localhost/about should not even exist. Ideally I would like to not have an _index.md file but Hugo complains if I don’t have one.

Content directory “/work/content/about” have both index.* and _index.* files, pick one.

.File.Dir on zero object. Wrap it in if or with: {{ with .File }}{{ .Dir }}{{ end }}

I am trying to have the following hierarchy

/content
-- /about
   -- /use-cases
       _index.md
       -- /some-use-case
           index.md
   -- /faq
       index.md

I should be able to access localhost/about/use-cases or localhost/about/faq but not the localhost/about . Is there a way to achieve this or at least redirect from the about and not have it appear in a google search?

Hi there,

Please have a read about Requesting Help

It is easier to help you if we can see your actual code.


This message is straightforward: it implies that you have both index.* and _index.*.

Again, this message is straightforward. Somewhere in your layouts, you are calling .File.Dir.

There isn’t much else we can help with without seeing the rest of your website code.

Well, these are the messages I get when I delete the _index.md file from the about directory (I believe you can’t have a directory without index file and then have subdirectories with them) but I have noticed this isn’t an ideal solutions because I am generating breadcrumbs based on that about/_index.md frontmatter.

I am looking for a Hugo solution to disable that exact /about route from the website. Can you point me in the right direction?

Have a look at the docs here:

It’s difficult to give you more specific advice without seeing your site code however.