Trying to get rid of some index pages

Hi,
I try to transfer a WordPress site to Hugo.

In WordPress, the posts are stored in a hierarchical folder structure, which I rebuilt in the “content” folder, eg: “content/post/cat1/cat3/name-of-article/index.html”

To be able to keep the URL structure, I added a “slug” to the front matter of each post (containing the WordPress slug identical to “name-of-article” and also added a “_index.md” file in each of the “cat”-folders.

The pages from WordPress are stored in “content/page/name-of-page/index.html”.

In config.toml I added:

[permalinks]
	page = '/:slug/'
	post = '/:sections[1:]/:slug/'

When I build the site, everything works as hoped except the fact that a “post” folder is created in “public” with the complete “cat”-structure and a “index.html” and “index.xml” file in each folder and also the complete pagination.

As I don’t need those folders (browsing “cat1” is “/category/cat1” and not “/post/cat1”) - is there a way to stop Hugo from creating these folders?

I tried adding “headless: true” to the front matter of the “_index.md” files, but this didn’t change a thing.

Removing the “_index.md” files creates all posts in “/public/name-of-article/index.html” and leaves out the folder structure.

Did some additional search and it seems stackoverflow has the solution: Subpages without _index.md file

As described, adding build options does the trick:

---
cascade:
  _build:
    render: always
    list: always

_build:
  render: never
  list: never
---

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