In the directory /content/handbook/ I have the following files: _index.md, manuals.md and styleguide.md
I would like all files under example.com/handbook/ to be displayed as if all the contents of the files were located in _index.md.
Does it make sense to rename the files as follows? _index.md, handbook-001.md, handbook-002.md …?
In Frontmater I made the following entry:
type: handbook
In /shortcode/handbook.html I made the following entry:
Question: Is it the right place?
{{ partial "header.html" . }}
<div class="grid">
{{ range where .Data.Pages "Type" "handbook" }}
{{ .Content }}
{{ end }}
</div>
{{ partial "footer.html" . }}
Do you need to create separate pages for the sub-handbook pages too?
If no:
Look into Leaf Bundles in documentation. You need to rename _index.md to index.md and then access the sub-handbook pages using .Resources.
No, the names of those pages (except _index vs index) are not relevant.
Also, shortcodes cannot be defined the way you have done. I’d suggest that you directly edit the handbooklayout file.
Shortcodes take the Page context in the dot… you need to use $.Page to get the page context. Also I have not used partials in shortcodes, so not sure if they even work that way… Basically the code style you have in the shortcode normally belongs to a layout file.
Yes. Also I think it’s {{ with .Resources.ByType "page" }} and you don’t need to enter something in the front matter of your markdown resources for Hugo to find them.
You are using a subdomain as your baseURL in your config.toml and your site hits 404 when running hugo server.
Now I don’t recall exactly the workaround for subdomains in the baseURL -as I never needed to use one myself-. Try searching the forum.
If you uncomment your first baseURL with the top level domain and comment out the one with the subdomain you will see that your Page Bundles under /handbook/ are rendered in the correct order.
What do you mean by hand? In the repo you linked to the md files under /handbook/ are already rendered in the order of:
Handbook
Manuals
Styleguide
and the corresponding files are:
0001-handbook.md
0002-styleguide.md
0003-manuals.md
It’s up to you what you want to do. If you feel like entering front matter parameters you can use range to render them by weight, date, or some other parameter.
If you do nothing Hugo will render them according to the default sorting order: Weight > Date > LinkTitle > FilePath