Is "shortcodes" a reserved keyword in sense of content/layouts?

I have a weird question. I am preparing all my reusable layout files as modules. Now my shortcodes are residing in a shortcode module. In dev environments (config/development/config.toml) I am mounting content to the local content directory. Inside of the content directory is a shortcodes directory with a markdown documentation of my shortcodes.

The only problem is, I can’t seem to get this parsed under localhost:1313/shortcodes. Loading that URL with the mount results in the index page being shown (last 5 posts). Removing the mount results in a 404 error, so the mount is definitely mounted somehow.

Adding an index.html to the layouts/shortcodes directory does not change anything.

I think it’s not possible to name a section in Hugo “shortcodes”. Am I right? Is that a bug or should it be documented? Thinking this issue further it’s probably impossible to add a “partials” section to a Hugo website too…

The repo is here if you want to play around:

Solution (working for shortcodes as URL and probably partials too, not tested that one though):

Rename the content/shortcodes to something else (content/folder), then add content/folder/_index.md with the following content:

---
url: /shortcodes
---

Then add to content/folder/something/index.md the following frontmatter:

---
url: /shortcodes/something
---

This will make localhost:1313/shortcodes/ work. Using only slug on the section index file won’t work, the subitems will have the folder part of the URL instead. So any page has to be forced to use a specific URL.

1 Like

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