I’m in the process of trying to replicate a website that I previously created using cockpit and PHP. One of the key points is that almost every page has at least 2 images. However, I’ve tried a few different ways to structure the content folder, and this has resulted in various issues.
Ultimately, it would be great if someone could just drop an answer with the recommended structure for multiple pages (no listing pages) and their corresponding resources. This way I can compare what I’ve got and see if I’ve made a mistake. For more details, feel free to continue reading.
Note
I currently have a functioning template that should load all pages into a menu in the header and display the text and footer of each page. This works perfectly for the main index.md
file (save that the menu isn’t always populated), and changing the structure of the content folders results in the page loading correctly (minus resources and occasionally the menu).
Front Matter
The pages that have image resources use the following format of front matter (with params being left out when there is no description):
resources:
- name: figure-:counter
src: "images/figure-1.JPG"
params:
- description: "Figcaption"
Structure 1
Originally, I placed all *.md*
files into the content folder. So it looked something like this:
index.md
index.de.md
bio.md
bio.de.md
images/
The images folder contains the resources to be used on both the index and the bio page. This works fine for the main index page, but the bio page did not appear in the menu nor would it load when the URL was supplied manually.
Structure 2
Here, I placed each “page” into a separate folder with resources, so it looked like this:
index.md
index.de.md
images/
bio/index.md
bio/index.de.md
bio/images
This method does (mostly) appear in the menu, but trying to use the defined resources fails.
Bonus Question
The design calls for the title/logo of the website to be loaded in the middle of the menu. In PHP I did this by calculating the halfway mark of all the pages in the menu, and then inserting it when the index was correct. Is this possible to do in Hugo/Go? If so, how would one go about getting the total number of pages?
Thanks!