I’m building a simple gallery with Hugo.
This gallery is composed of several sections, each one contains a bunch of
pages. I’ve added previous/next links on each page to navigate across sections.
I use Hugo’s taxonomies to group pages associated to a given tag together.
Each tag has its own page where I’ve put links to all pages associated to that tag.
So, when someone browse a tag page and go to an associated page, he arrives on
a page where the previous/next links are not necessary associated to that tag.
I would like to build my site so that the previous/next links on a page
linked in a tag page point to previous/next pages associated to that tag.
There may be multiple ways to do it :
create different static pages for all tags
create dynamic links in pages so that these links change according to the
tag or section which is being browsed.
I’ve encountered some issues trying to build your example site:
$ hugo -b http://localhost:1313 --verboseLog
Building sites … ERROR 2020/04/19 11:12:44 render of "page" failed:
execute of template failed: template: photo/single.html:4:3:
executing "photo/single.html" at <partial "meta" .>:
error calling partial:
execute of template failed: template: partials/meta.html:51:3:
executing "partials/meta.html" at <partial "css/css" .>:
error calling partial:
"/home/loic/Documents/Projets/HugoSample/themes/photon/layouts/partials/css/css.html:2:6":
execute of template failed:
template: partials/css/css.html:2:3: executing "partials/css/css.html" at <partial "css/tachyons">:
error calling partial: "/home/loic/Documents/Projets/HugoSample/themes/photon/layouts/partials/css/tachyons.html:2:6":
execute of template failed: template: partials/css/tachyons.html:2:6: executing "partials/css/tachyons.html" at <hugo>:
can't evaluate field IsProduction in type interface {}
Maybe I use a too old version of Hugo ?
$ hugo version
Hugo Static Site Generator v0.65.3-211BA42A linux/amd64 BuildDate: 2020-02-23T09:59:37Z
So I’ve tried to setup my config.toml file according to your post, but I’m not sure to understand how it works.
It doesn’t change the number of static files generated by Hugo: I had already tags pages with an URL like “/tags/:slug”.
But on theses pages, I used links to simple post ("/section/:slug").
On these pages there are links too previous and next post in the section.
So when you use these links, you may go to a pagfe associated to another tag.
I would like to navigate accross tag related pages.
Is it possible to generate multiple HTML pages from a single file.md ?
In that case I could try to define multiple permalink like:
"/:section/:slug" <- basic page with previous/next links associated to sections
"/tags/:term/:slug" <- page associated to the tag term with previous/next links associated to tag