Hugo

Generate multiple static pages from each .md file?

Is it possible to make more than one static page from each .md file?

For instance say I wanted:
red-widgets.md

to generate the pages “/red-widgets/index.html” and “”/red-widgets/permissions.json"
?

Or alternatively:

“/red-widgets/index.html” and “”/red-widgets-permissions.json"
?

Thanks for this. I’m just revisiting the idea now. I have my site pages set in toml markdown like this:

type = “book”
layout = “book”
url = “harry-potter”

Is it possible to modify that to make a second page with a different layout? Something like this?

type = “book”
layout = [“book”, “book-fullscreen”]
url = [“harry-potter”, harry-potter-fullscreen"]

?

Or does it have to be via the config file?

You need to create a “fullscreen” output format and set its params in the config files.
This custom output format will have to live alongside harry-potter/index.html as harry-potter/index-fullscreen.html (or something). You may be able to have it live inside a directory as harry-potter/fullscreen/index.html but I’m not sure…

Then, you’ll have to set up your hosts as to make url rewriting from harry-potter-fullscreen/ to harry-potter/index-fullscreen.html

Study the doc on output formats and if you need help on those, hit the discourse with the info you missed from the doc!

Also this tutorial, although not dealing with html but json, https://forestry.io/blog/build-a-json-api-with-hugo/#/ is a good starter for understanding how Output Formats work.