Assistance Understanding Singular/Plural Content Types

Hello All,

I am using a theme with singular archetypes. So hugo new page/About.md seems to catch but hugo new pages/About.md does not.

Accordingly, /page returns the list of pages, however, I would prefer /pages to do the same.

I read this page and this page, but do not see any obvious solution to my desired result, so posting here. :slight_smile: Is there a way to simply render all my Page type under /pages rather than /page?

Thank you for any assistance you can provide. :+1:

Hi there,

Have a read of the docs here: https://gohugo.io/content-management/organization/

Basically, Hugo will render your site based on the structure of your content. So if you have content/lorem/ipsum.md you will get yoursite.com/lorem/ipsum, (unless overridden by defining alternative urls or aliases etc).

So if you have content/pages/abc.md and content/page/xyz.md you will get yoursite.com/pages/abc/ and yoursite.com/page/xyz/.

This means that if you rename content/page/xyz.md to content/pages/xyz.md it will now render at yoursite.com/pages/xyz/.

As for the archetypes: https://gohugo.io/content-management/archetypes/#create-a-new-archetype-template

you can create your own, reflecting the section name it is to be applicable to, ie archetypes/pages.md

1 Like

Great thank you for your help, @pointyfar! It would seem my concern is confirmed, thenโ€ฆ I have to either stick with /page or duplicate every single archetype file in the theme as my own and pluralize them if I want to use /pages. Please let me know if I have misunderstood something.

Alternatively, you can configure what permalink format to use or set the url manually in the frontmatter. Have a read here: https://gohugo.io/content-management/urls/

Ah, I do have permalink already configured:

permalinks:
  article: /:year/:month/:title/
  page: /:title

However, that does not seem to place content in the /pages/ location as desired. I am also aware of setting the URL manually in the front matter but I am searching for a less cumbersome approach for my desired result. I appreciate any further assistance you or others might provide.

page: /pages/:title/

Ah unfortunately that does not generate the list of pages in /pagesโ€ฆ the list still remains on /page. Additionally, I would prefer the links for individual pages to be at the root, as there are not very many of them (and consider them the default content).

Iโ€™m confused now.

but you also want them under /pages/?


Add content/page/_index.md set url in the frontmatter to url: "post" .

Woohoo! Thank you. That did the trick. For completeness, I created an /content/page/_index.md with the following content:

---
url: pages
---

Thank you, @pointyfar!

Sorry got so excited by the solution I didnโ€™t reply to this. :grin: For single pages I want them to render under the root โ€“ this is done via permalink. For the list of all pages in the site I want them to render under /pages/ โ€“ this is now done via _index.md.