How to create a dynamic child-page for content

Hi, I have a folder content/posts filled with posts as markdown files. These are rendered with layouts/posts/single.html. So far so good. The URLs will by default be:

  • /posts/{slug}

Now, I’d like each post to have a dynamic subpage like

  • /posts/{slug}/subpage

Couldn’t figure out how that’s supposed to work within the Hugo templating system. Any pointers would be appreciated. Thanks.

What does dynamic mean in this context?

That the subpages wouldn’t be generated from a unique markdown file. Let me try to give another example.

  1. posts/hello-world
  2. posts/my-second-post

Both would get an automatic subpage like so:

  • posts/hello-world/subpage
  • posts/my-second-post/subpage

But since I have one million posts, and the subpages don’t have any unique content, I’d like to avoid creating an empty for each post to get a page at these URL. Hope it makes sense. Any ideas?

only an idea to start…
for the subpage:

categories = [“PostSub”]

in config

postsubs       = "/posts/:slug/subpage"

Try to put the subpage in content in a subdir of the page, bc must have the same slug / filename