pictures should contain all post’s from subdirectories, 2017 should contain all posts’s from 2017 subdirectories and so on.
so my question is, is it possible to get this kind of content assingment working without a huge bunch of programming, e.g. build lists for every section, configure every menu in config.toml etc. (i’m not a good programmer) ?
the structure is almost static, so an initial big work wouldn’t be a problem.
Well… Regarding your first problem about assigning content to multiple sections -as you put it- this is not very straightforward in Hugo.
There are two options
Go by the book.
If you read the Docs you’ll see that the way to do this is through the use of taxonomies and then create multiple layouts for different lists and use .GetPage in your templates. This the safe and future proofed version.
Don’t follow the rules.
In this forum there have been topics about dynamic taxonomies filtering, custom content filters and the like. But all of these are currently considered hackish -I’m afraid- but these will give you what you want without having to make lots of templates for different lists. However if you go down this route it is quite possible that a future Hugo update might break something in the functionality of your site.
What you’re asking for has no easy answer and it’s up to you to choose what you want to do.
Now regarding your second problem. Read about Nested Sections. It’s trivial to list all posts from several nested sections under /pictures/ and then everything under /2017/.
I just remembered that since Hugo 0.32 there is support for symbolic links. I haven’t used them for assigning content to multiple sections, but now that I think of it I’ll check this out and share my findings.
Ah! I just discovered that it is possible to disable the page duplicates by setting the URL in the front matter of the original content file! The downside is that this is another front matter parameter that needs to be entered manually. But that is a very small price to pay.
No need for .GetPage, no need for several list templates and no more Taxononomies weirdness.
Symbolic links to content files are the easiest way in Hugo to assign content to multiple sections and nested sections.
@bep Thank you so much for symbolic links! I just realized what an amazing feature it is.
There was a lot of activity in this thread, and I am gonna be a wet blanket and point out two things about the question about “navigation paths”:
Humans don’t expect to find the same content at different URLs
Search engines therefore don’t expect to find the same content at different URLs
Pick whichever one applies more to your goals, but there is it. If you do somehow figure out how to do that with the URLs, your site won’t benefit from it. I wish I had a good information architecture book suggestion, but I am sure if you ask around you can find good resources to go over the vocabulary used, so then you can describe the experience you want for your visitors, and then figure out how to structure it in the way that helps them.
If you have content1, content2, content3 and compose content1+content2 in one URL and content1+content2+content3 in another, you will have duplicate content – but not same. And the above pattern is useful to avoid DRY in some situations.
Yes. But it’s not simple to do this with Hugo. At least I haven’t found it. And believe me I’ve tried several times in the past few months…
If I go down the taxonomies route I end up with useless taxonomy URLs, if I disablekinds for taxonomies sometimes the taxonomies stop working altogether and sections (nested or not) render empty… .GetPage requires different templates for different lists, (that’s too much work IMO but I guess it’s the only way).
And regarding my unconventional use of symbolic links for this issue.
Even though I eliminated duplicates from list pages I am unable to remove the identical duplicate pages from the sitemap.xml. Since the symbolic links are under Nested Sections there is no easy way to hide them. eg. A param in _index.md does not hide .Data.Pages under a Nested Section.
Anyway. My head kind of hurts and I have other very urgent things to do, so I guess that I will try to figure out a simple way to assign content to multiple sections and nested sections some other day…
And my apologies to the OP for hijacking the thread.