UWCS/stardust

Colocating resources

Closed this issue · 0 comments

Zola has some nice stuff with colocating images with content (put images with content, not in a separate resources dir), but this also makes sense in a section (like content/resources/git-good is atm), but zola doesn't allow listing pages and sections mixed (and definitely not paginated or sorted), which is a bit of a pain if we want to generate a list of pages (when these sections are really just pages).

There is some discussion of some merged concept of a page/section for Zola, but one place says they are waiting on a Tera (template engine) update, and everywhere else is inconclusive dialogue. So fixes are implement it outselves or ✨the hacky way ✨:

  1. Within the section, create a _content.md (or whatever you want to call it), put your page content in here
  2. Set a slug = "content" in the frontmatter
  3. Remove all content from the section, and add:
transparent = true
redirect_to = "<path to section>/content"

Transparent makes sub pages of the section list with the section's parents and the redirect makes the direct section link redirect to the content. This isn't ideal as it has two urls, but it works (either this or give up on colocation)

The most frustrating part is that pages cannot redirect in Zola, otherwise that would be a much better hack (just have the same child page to each content section)