Remove list page

I’m creating a new category of pages. For example, I would have a category named “films” and my pages URLs would be

But I don’t want the page to exist (corresponding to the list.html template).

How can I do that ?

You could fill a layouts/films/list.html layout with the content of your 404 page, therefore would return “not found”. Were you thinking of something better?

Or simply add as an alias in your 404 page, I don’t know…

If you can live without any categories, you can also use this in config.toml:

# Allows you to disable all page types and will render nothing related to 'kind';
# values = "page", "home", "section", "taxonomy", "taxonomyTerm", "RSS", "sitemap", "robotsTXT", "404"
disableKinds: []

How can I set an alias for this page? Normally I should set the alias in the .md page but where should be the .md page corresponding to the list page?

Actually I need categories in my website so this doesn’t seem to be the good solution for me

I’m new to Hugo so I’m not sure, but you could just add something like

    - /films/

to the frontmatter of your /content/ homepage for example. Then would redirect to the homepage of your site.

Or you can create any custom error page and add the alias to it, if you’d rather display an error message than redirecting to the homepage (but this would only simulate an error page, it wouldn’t send an appropriate 404 HTTP response/header).