Welcome to the Power Users community on Codidact!
Power Users is a Q&A site for questions about the usage of computer software and hardware. We are still a small site and would like to grow, so please consider joining our community. We are looking forward to your questions and answers; they are the building blocks of a repository of knowledge we are building together.
With Datenstrom Yellow SSG, how do I generate lists of tags and recent posts for my blog?
I would like to use a static site generator to create a personal blog. I'm new to SSGs (but not to blogs). Following some initial research and recommendations, I chose Datenstrom Yellow for its apparent simplicity (Markdown source and an easy "build" step to generate HTML, which I can then upload to my server when ready). I'm stuck at page layout.
I'm using the blog extension and can run the example just fine. The documentation on that page shows example Markdown for (a) a list of latest posts and (b) a list of tags. What I can't figure out from the documentation, or experimentation, is where to insert that Markdown to produce the desired effects.
From their readme:
Showing list of tags:
[blogtags /blog/]
[blogtags /blog/ 3]
[blogtags /blog/ 10]Showing list of pages:
[blogpages /blog/]
[blogpages /blog/ 10 Datenstrom]
[blogpages /blog/ 10 - example]
There is also a layouts
directory, which contains a likely target, blogpages.html, which the description says is the layout for the main page. Two problems: first, that's HTML not Markdown, and second, it's actually full of PHP (which is Greek to me).
What do I edit to cause the lists of tags and recent posts to show up on the blog page? A search took me to this example site, built with this tool, that has these lists (in the right column), but I can't find source to look at. That site looks to be the work of a beginner who's a little ahead of me on the learning curve; it's not a production site.
1 answer
The answer turns out to be to add a sidebar, which is a separate element. First, you have to use the Berlin theme, not the default. This theme adds a line to system/layouts/default.html
:
<div class="<?php echo "content".($this->yellow->page->isPage("sidebar") ? " with-sidebar" : "") ?>">
For some reason the blog templates don't get updated when you switch to this theme, so edit that line into blog.html
and blogpages.html
.
Next, you need to create the actual sidebar page. In the shared
content folder, add sidebar.md
as in the following example:
---
Title: Sidebar
Status: shared
BlogLocation: /blog/
BlogNewLocation: /blog/@year/@month
---
Tags
[blogtags /blog/ 10]
Archive
[blogarchive /blog/ 50]
In blogtags
and blogarchive
, the last argument is the number of entries to show. I haven't yet figured out how to show all tags, or all archive months, on one page.
These changes add the sidebar to all pages on the web site. Mine is, first and foremost, a blog, but if you have other types of content in their own sections, you might not want your blog archives to show up in, say, your portfolio. I suspect that deleting that line from default.html
, so only the blog templates have it, would accomplish that, but I haven't tried it.
0 comment threads