@help If I create a new page on Micro.blog, what template does it use in the theme files? How can I get it to use a different template other than the default one?
@help If I create a new page on Micro.blog, what template does it use in the theme files? How can I get it to use a different template other than the default one?
@pratik micro.blog doesn’t really use pages, everything by default is a post. If you want a custom template, I recommend doing layouts/$custompagename/single.html
for your template, and then create content/$custompagename.md
for your content in your theme, putting the type:
field in the front matter set to custompagename
@jsonbecker Wait, what? I understood some of those words. Also, how will it fit with my existing blog’s design if I’m adding a new single.html
?
@jsonbecker So the $custompagename.md
will use the design specified in the single.html within the /custompagename
subfolder? Basically, I want to create a custom page to show posts only from a couple of categories. Would I need to copy the HTML file from /layouts
and then add the custom code?
@pratik you’ll take your layout for either index or your li.html (if you want to copy archive style) and copy it to layouts/custompagename/single.html. Then adjust code to filter for categories. Then add a new page to your theme called content/custompagename.md (content at top not layout). The whole content of that md file is just yaml front matter setting title and the type, where the type matches the custompagename. That says to render the md file with the single template for the matching type.
@jsonbecker Coming back to this years a few years later, but this is exactly what I was looking for. Thank you!
@jnicholson let me know if you need any further help! I post a bunch on help.micro.blog on some of this stuff too as needed. I still use this technique for things like my blog’s book page and now page.
@jsonbecker thanks! I was trying to make a custom Books page as well. Ran into some issues now working with bookshelves and goals and also somehow got my site in a state where it won’t let me add a /books link. However, I did get something made that’s a start.