6 ms·
> I got really frustrated with Hugo yesterday when I couldn't add a page with just a list of all my posts on it. I know you weren't asking for solutions but I'
by jxf 4y ago
> I got really frustrated with Hugo yesterday when I couldn't add a page with just a list of all my posts on it.
I know you weren't asking for solutions but I'm surprised to hear this. That should not only be trivial but is something that ships by default when you init your site. For example this should be enough on your list page:
<ul>
{{ range .Pages }}
<li>
<a href="{{ .Permalink }}">{{ .Title }}</a>
</li>
{{ end }}
</ul>
- michaelmcdonald 4y agoI took it to mean not a list of post _titles_, but a full output of posts on a single page (a la DaringFireball). I tried to do the same not that long ago (was just starting to toy around with Hugo) and could not find an easy solution to it.
- linsomniac 4y agoThank you for the suggestion. When I was searching for solutions, I got a lot of snippets like yours, but I couldn't for the life of me figure out how to turn a snippet like that into a page on the site. The best I ever got was a markdown page that was a copy of the "about.md" page, but I couldn't get that to show anything but static content. I created this 3-4 years ago, hacked on it some to get it where it is, which I tried not to be too crazy. But maybe I just munged it up somehow. Maybe I just need to start over again with the latest Hugo and get brained up. Hugo has nice documentation, but it fairly quickly goes from "put a few markdown pages here and run hugo" to "read the rest of the book". Which is probably just the nature of the beast.
- jxf 4y ago> When I was searching for solutions, I got a lot of snippets like yours, but I couldn't for the life of me figure out how to turn a snippet like that into a page on the site. Completely understand. If this is helpful, the way Hugo works (and the way many static site generators work) is that you make a template for each kind of page that you want to appear in the final output. A typical blog might have, say, three templates: a template for the homepage (show a quick bio and your most recent posts), a list template (show all your post titles and links), and a post template (show one post at a time). When you generate the site, your content will be processed through the templates. For a typivally sized personal site this happens in under 100ms. In Hugo, when you initialize a new site, these templates will already exist for you, so you won't have to write them, though you can of course edit them. (The out of the box defaults also include other kinds of things you might or might not care about, like tags or categories.)
- linsomniac 4y agoThank you, that description is very helpful and clarifies some things in how the "layout" in the frontmater influences the page.