Index.html

Hello

I am sure I am missing something blindingly obvious.

I have built a site with zola. works fine. really like it. But I dont get the index.html in templates. I would like to make my index page the same way as all the other pages from markdown, with the toml header, which allows all the nice template macro features.

But I cannot figure our how to do the same with the main index file. It cannot have a toml header, and I cannot pass those variables to a macro template html for the header. I tried to make content/_index.html but that did not work

so what I ended up was to make a md in contents, build, and copy that to templates/index.html, which cannot be the right way.

and for my next problem, how to get a a list of all blogs on the main index page

I am sure I am very stupid and missing the obvious,

best, j

The file content/_index.md is the markdown for index.html

1 Like

Thanks @keats !

I had tried that and put into it

+++
title = "What "
template = "index.html"
+++
text

and then into index.html

            {% block content %}
            {{ page.content | safe }}
            {% endblock content %}

and get

Reloading only template
Error: Failed to build the site
Error: Failed to render section '   /content/_index.md'
Error: Reason: Failed to render 'index.html'
Error: Reason: Variable `page.content` not found in context while rendering 'index.html'

so I thought I was missing something obvious, like is page in {{ page.content | safe }} incorrect? its not index.content or section.content either.

all the best, j

The index is a section so you need to do {{ section.content | safe }}

1 Like

Thanks a lots @keats

it all makes sense. I now read all the docs twice and it is there. sorry for my stupidity

j