ℹ️ Custom home page

By default, Micro.blog shows the most recent posts on your blog’s home page. You can override this by creating a custom theme with a different home page layout that includes any text.

Start by clicking Posts → Design → Edit Custom Themes. Create a new template named layouts/index.html and paste in the following:

{{ define "main" }}
  This is the home page.
{{ end }}

You can replace the content in the middle with any HTML. The special {{ define }} tag will automatically wrap your text with the blog’s default design.

Go back to your site settings under Posts → Design and select the new theme, then click Update Microblog Settings.

Including categories

You can also customize your home page so that it only includes specific categories. For example, you might want the home page to only include longer posts, or only photos.

In the new layouts/index.html template, you can specify a category when building the list of posts. To only include posts in the “Essays” category, the code will look something like this:

{{ $paginator := .Paginate .Site.Taxonomies.categories.essays 25 }}
{{ range $paginator.Pages  }}

Or to include posts from 2 categories such as “Essays” and “Photos”:

{{ $paginator := .Paginate (union .Site.Taxonomies.categories.essays .Site.Taxonomies.categories.photos) 25 }}
{{ range $paginator.Pages  }}

The exact HTML for your template will vary based on the default design you are using. For a version using the Marfa theme, see this GitHub Gist.

1 Like