How not to render content as a page

Question: Is there a way to tell hugo not to render a page at all?

Motivation:
I need to put a slideshow on the homepage that also features rich text.
I would like to organise the content in the following structure

content
└─ home
   └─ slide_1.md
   └─ slide_2.md

That works just fine. The only problem is that hugo generates additional pages

public
└─ home
   └─ index.html
   └─ slide_1
      └─ index.html
   └─ slide_2
      └─ index.html

Can I prevent those pages from getting generated?

Thanks for your feedback!

Maybe related

Currently there isn’t a better way of doing this, but it’s clearly a weakness Hugo has at the moment and needs to improve. Open to suggestions from anyone on a better approach then we currently use.

I am very new to hugo so I cannot speak from an implementer’s perspective but from an end user’s perspective a straight forward way could be to use Front-Matter that works similar to the draft variable, e.g. like Jekyll uses

---
published: false
---

Which do you want generated and which do you not? It’s not clear from your post. Maybe show a tree for both?

@michael_henderson The files slide_1/index.html and slide_1/index.html should not get generated.

I like the idea of the published flag, although for now you could archive the same with the draft flag, couldn’t you? As long you are not generating the drafts explicit.

Also the published sounds like the opposite of the draft flag to me. Maybe naming it hidden would be less confusing?

1 Like

I’ve implemented remark.js slide shows by pulling the slides in as a partial. That bypasses rendering. Go here and choose Wireless RDMA from the side menu for an example.
Implementation details here

Thanks for the links. Can this hack also be used to solve the problem I described in the first post of this thread?

Has someone figured out a solution for the problem?

The following code snippets are preventing the build of the folders, but also forbids the access inside the index template.

ignoreFiles = ["content/home/"] in config.toml

or

publishdate = "3000-01-01" in slide_1.md

I believe this issue is covering the feature request: https://github.com/gohugoio/hugo/issues/3612.

Yes, there is a way.
Put this into the baseof.html
{{ if .Params.render }}
page goes here
{{ end }}
And put this into frontmatter of pages that should be rendered
render = true
All other x.md files will not be rendered by hugo command.
Note: the hugo server will still render all pages.
Note: also put the code into the sitemap.xml How to omit page from sitemap (But use current sitemap.xml from https://gohugo.io/templates/sitemap-template/)