Markdown in a section list page?


First of, thanks for creating this excellent bit of software. I forgot how much I liked writing because I used to spend all my time fighting the tools.

I have a section list template that I have written that pulls some keys out of the front matter of all the pages in that section, and renders them into a table. So far so good, but I want to have a bit of text at the top of the page explaining what the table represents. Is it possible to write that text in a content markdown file and have the template render it out, or do I have to fall back to having content as HTML in the template?


Having List front-matter and content in a markdown file is on the road map, but it’s not possible right now. You have to do that in the HTML layout.

Thanks! Is there a Github issue or something covering this? I’ve been looking for an excuse to learn Go

I don’t think there is a GH issue simply because it’s not a trivial fix. See Node Improvements for a discussion of the topic. If you’re new to Go, I’d suggest starting with something smaller. :smiley:

We tag some of our GH issues with experience-level tags. See the beginner issues.

I was in a similar situation and just abused content types for that on my frontpage. I just created a post with a unique type and used .Data.Pages with some filtering to just fetch that one post for rendering. You can find an example here :slightly_smiling:

What I have suggested in another thread is to store these “section list” texts in /data.

Then do:

{{ (index .Site.Data.sections .Section).someText | markdownify }}

The above is typed really fast and probably full of error. But I hoe it gets the message through.

Thanks! I ended up implementing a variant of this. Template has two loops, one that renders out all pages in the section with the type ‘_header’, and the other that renders out everything that isn’t ‘_header’.

Awesome. Thanks for sharing! I’m currently evaluating Hugo and the “markdown in a section list page” issue was something that was kind of a blocker for me. Your solution is however elegant and easy to implement. So thanks again!

Sounds great. Would you mind sharing some sample code?

Sure. The section template is here, and the content is in here. The resulting site looks like this

1 Like

Thanks! This is really helpful!