I’m trying to better understand how to customize the content for my Pages on micro.blog. I want to customize a reading page using the data available in the new bookshelves feature.
I’ve tried putting a template in:
layouts/posts/reading.html.html or layouts/posts/reading/single.html but I don’t think the content is picked up in either one. I’ve also tried using a trick I’ve used before, with {{ if (eq .Title "Reading") }} in my layouts/posts/single.html but that also doesn’t seem to get picked up/triggered on the page generated by creating a new page at myurl.com/reading (even though it appears to me that Reading is the page title).
Is there any front matter I can use to determine if I’m on this page? What template does it draw from and is there a way to target that template?
In stock Hugo, I suspect I’d either make this a type (not post) or have this as reading.md not under posts and use a layout like layouts/reading.html that I think would pick that up (and that md file would probably be just front matter).
Pages on Micro.blog have always thrown me off a bit because they seem like posts with custom permalink URLs, but they have been a bit hard to target with anything other than standard post markdown content to be processed by layouts/posts/single.html.
EDIT: Just to add a little bit of extra info: The info provided here about a custom 404 page seems to suggest that if you have a page with the slug /test then a template /layouts/test.html should be applied. Sadly this is not the case for me.
Yeah, this is confusing and I think Micro.blog needs some tweaks to make standalone pages work better, like extra post types. I think for now what you want to do is create a file in the theme in the “content” folder, like content/reading.md and then specify the layout in the front matter?
@manton I still would like to know. I have plans to customize my blog, but I am blocked by not knowing/understanding how pages work. I think I grok Hugo’s templating enough. I just don’t know how to apply a custom template to a page. It’s quite frustrating that I can’t seem to figure it out.
Thank you so much for your helpful post! I tried it out and it seems to work, sadly for my use case, namely having another list-page for a filtered down list of my blog’s content, I couldn’t get it to work.