Postlist

Shortcode for adding a list of posts

Postlist is a Micro.blog plugin that will add a short-code allowing you to a list of posts to a page, similar to Bear blog’s posts macro. The list of posts can be filtered to those of a specific category, and displayed either in chronological or alphabetical order.

A list of technical cheatsheets covering topics such as Linux commands, Git, language notes, and setting up a development server is displayed.
Example of a post list using this short-code, taken from this page.

Usage

Once installed, a post list can be added to a post or page by using the following short-code:

{{< postlist >}}

This will produce a list of all posts — both with and without titles — ordered in reverse chronological order.

Filtering By Category

Use the categories attribute to only show posts that match a given category:

{{< postlist categories="Cheatsheet" >}}

Category names are case sensitive, and must match the name of the category as entered in Micro.blog. Multiple categories can be specified with commas, and a post must be in each one in order to appear in the post list.

{{< postlist categories="Cheatsheet,Git" >}}

Ordering Alphabetically

By default, post lists are appear in reverse chronological order (newest posts appears on the top). If you want to order your posts in alphabetical order, from A to Z, you can set the order attribute to alpha:

{{< postlist order="alpha" >}}

For those that are familiar with Hugo templates, this uses link title ordering, which loosely corresponds with the title, or the first few words of a titleless post.

Styling

Post lists are rendered as an unordered lists with the postlist class:

<ul class="postlist">
  <li><a href="...">Item 1</a></li>
  <li><a href="...">Item 2</a></li>
</ul>

The default CSS sets the list style to none and removes the leading padding, but otherwise keeps the list unstyled. Post lists can therefore be restyled by adding a ul.postlist CSS rule.

Feedback

Any feedback — bugs, feature suggestions, etc. — on this plugin is welcomed. Probably the best place to raise them is by creating an issue on GitHub. Alternatively, you can hit me up on Micro.blog.