Truncated posts on your microblog

Customizing a theme.

If you write a lot of longer posts, you may want to only include the first part of those posts on your microblog’s home page. By default, Micro.blog will include the full text of each post on your home page. You can use custom themes to customize this.

To get started, create a new custom theme or edit an existing one. In Micro.blog on the web, click Posts → Design → “Edit Custom Themes”. After you’ve created the new theme, go back to the Design screen for your blog to select the new theme, then click “Update Microblog Settings”.

Custom theme buttons

Click “Edit Custom Themes” again to edit your custom theme. It will automatically show any templates used in your microblog’s current design. Click any of the templates to create an edited copy of the template that will override the default.

Templates list

To change the home page, edit the template list.html. Find the HTML in the template that looks like this:

  <div class="e-content">
    {{ .Content }}
  </div>

Change it to this and save the template:

  <div class="e-content">
    {{ .Summary }}
    {{ if .Truncated }}
      <p><a href="{{ .RelPermalink }}">Read More</a></p>
    {{ end }}
  </div>

This will include the first 70 words of the post, then a link to the full post. If you’d like to control where the post is truncated, you can add a special comment in between multiple paragraphs of your blog post. Micro.blog’s theme will use this to effectively cut the post in half:

  First paragraph of your blog post here.

  <!--more-->

  The rest of the blog post continues from here.