HUGO

[SOLVED] Ignore section but render its content with custom url

Hello,

I searched this forum for a solution for my problem but I do not seem to be able to find anything useful. As it’s probably known from another thread by me, I’m working on a german/english page and I make heavy use of the url override via front matter. Now I have a section called services which will be used to group all service related content. The destination url should be /our-services for english and /unsere-dienstleistungen for german.
While this works for the content inside of the section, hugo will also build a folder called services. The only file inside this folder is a index.xml. Hugo will also include this section into the sitemap/rss feed although I have no use for it.
How can I disable the creation of this section but do not disable the rendering of its content? I want to be able to get the content of the section via .Site.GetPage so I only want to remove all occurences of /services from the sitemap/rss feed.

I saw that there’s already some kind of PR in the works but I’m not exactly sure if it would solve my problem too so that’s why I’m asking.

Thanks for answering

What you’re asking is not possible.

You can though hide the root index of that section from your sitemap and search engines.

Search the forum for adding a param called hidden (or anything you want) in the _index.md of your section and how to conditionally render your xml if that param is not present.

As of Hugo v0.33, it’s now possible to specify a custom url for sections via front matter. Using a _index.md file with it’s localized counterparts it’s now possible to do what I wanted without using any hacks. This topic is now solved