I just put hugo-theme-recipe up on Github. This is a clean, scalable design that currently supports one layer of nesting, and scales up to thousands of content pages (currently 12,276 on my work-in-progress test site, which builds in about 9 seconds on my laptop). It includes a few tricks like embedding referenced recipes for printing (using the new
$.Site.GetPage "page"), a random-recipe link, and an alphabetical page index for large sections.
Two things I couldn’t find easier ways to do:
.Content from another page is non-deterministic; each time you build, it may or may not render anything. Fields like
.Title are fine, but I had to use
.RawContent | markdownify to get recipes to reliably embed.
Maybe it’s in the documentation that’s being written, but the only way I could come up with to get a link to the current nested section was:
($.Site.GetPage "section" (trim .Dir "/")).RelPermalink
I overidded the built in relref shortcode to manage links to sections (_index.md)
See here : https://github.com/vjeantet/hugo-theme-docdock/blob/master/layouts/shortcodes/relref.html
With this trick, existing relref calls continue to work as before while handling sections/_index.md
No, it happens with a full build. For instance, if I use the example
content directory I included with the theme, “Aunt Susie’s BBQ Brisket Poor Boys” has two embeds, and I can get either just their titles, or the title of the first and the full second recipe, or the first recipe and its embed and the second recipe. (using
.RawContent | markdownify prevents the recursion in this particular example, which is probably for the best…)
Still working on a solid repeat-by for this. The more calls to
.Content from the shortcode in a single page, the more often it happens, but the specific recipe I included in the theme example triggers it much more frequently because it’s recursive (the embedded recipe has its own call to the embed shortcode). I need to construct a set of non-recursive samples that trigger it often enough to be useful for testing.