How to have text, not list of posts, on the home page

I can’t find a way to have the home page be just a regular page. It looks like the homepage is generated from index.html, which lists all posts on the site.

I don’t want to have a list of posts anywhere. I’d like my homepage to be a manually-written markdown page.

I could edit index.html and put my homepage content there, but then I’d be using plain old HTML, and I’d prefer to use markdown.

Am I missing something? I expect content/index.md to be visible as body of the home page (/ url), but it’s not.

It’s content/_index.md with an _ as the index is a section.

All depends on the theme you’re using. Which one do you use ?

I’m trying to migrate my existing site to Zola, so I’m also trying to create my own theme that reproduces what I had before.

Existing themes all have a list of posts on their homepage, which as I’ve mentioned, is not appropriate for my content.

I’ve tried _index.md as well, but I don’t know how to make it show in the homepage body. Just creating that file is not enough.

Ok so if you are creating your own theme, you have to understand the basic mechanisms of the theme engine. You have several options here :

  • sections can have their content too, you can just use the section object as if it was a page
  • you can do a redirection of the main section page to a page of your choice (landing page)

If you need a concrete example, I can write one for you.

1 Like

You can use {{ section.content | safe}} in index.html if you have content to show: https://github.com/Keats/tera/blob/master/docs/templates/index.html#L56

1 Like

I ran into the same issue. I was about to get what I want by…

  1. Making the content page into a section naming it content/_index.md.

  2. In the template my _index.md is extending (which is the same page.html all content htmls of mine use), I added this snippet before accessing any page properties:

    {% if page is undefined %}
    {% set page = section %}
    {% endif %}

With that my section works as if it were a page, and I got my landing page to work that way.

I wanted to add that I’ve just started with Zola and after quite a while skimming the docs and then reading them more carefully I was still quite confused how to get markdown content on to the home page with the default set up. I have little experience with static site generators but I’ve found that aspect confusing. It seems very titled towards sections & pages without mention of how to get markdown content on to the first page that you see.

I’m looking to write an educational overview on a subject and it seemed most reasonable to start with content on the homepage and move from there as it gets more complex. This might not be the usual approach.

1 Like