Creating 'static' content that uses partials

@brad, sorry for the delay.

I have three files that work together on this:

config.toml
content/top/about.md
layouts/top/single.html

The “single content file” that I mentioned is the layouts/top/single.html file. The “type” of content/top/about.md is “top”, so Hugo looks for the template in layouts/top/single.html. The rule is that /content/SSSS/zzzz.md will be rendered with layouts/SSSS/single.html if it is available.

In my config.toml file, I have

[permalinks]
	post = "/blog/:year/:month/:day/:title/"
	top = "/:filename/"

Since the [permalinks] in my config says top = "/:filename/", Hugo will render about.md to public/about/index.html. The :filename seems to mean “the basename of the file,” so it strips the path and the “.md” extension.

When I first started this, I also put type = "top" in my about.md file. It was simpler to just create the section content/top and use that. That way, nothing special needs to be in the markdown file.

1 Like