Hi,
I’m embarrassed for this beginner question and been struggling for over a day getting nowhere.
I noticed that most of the themes assume the top level content/
is where the blog lives and has pagination but I want the document root to act as a simple landing page and all other items in pages/ should just be things like pages/contact.md
, pages/about.md
etc (or they can just live in content/about.md for all I care as long as the only place that uses blog logic is content/blog/*
(e.g. have blog pagination).
For this I created a local templates/home.html
(which I took from the zola-clean-blog theme) with the following content:
{% extends "index.html" %}
{% block header %}
<!-- Page Header -->
<header class="masthead" style="background-image: url('{{ get_url(path="/img/about-bg.jpg")}}')">
<div class="overlay">
</div>
<div class="container">
<div class="row">
<div class="col-lg-8 col-md-10 mx-auto">
<div class="page-heading">
<h1>Foo Bar</h1>
<span class="subheading">Foo bar bla</span>
</div>
</div>
</div>
</div>
</header>
{% endblock header %}
{% block content %}
<!-- Main Content -->
<div class="container">
<div class="row">
<div class="col-lg-8 col-md-10 mx-auto">
{{ page.content | safe }}
</div>
</div>
</div>
{% endblock content %}
I’ve then my content/_index.md which loads it like this:
+++
template = "home.html"
render = true
+++
zola throws an error when trying to render this:
Error: Failed to render section '/home/joachim/src/libreguard/content/_index.md'
Reason: Failed to render 'home.html'
Reason: Variable `page.content` not found in context while rendering 'home.html'
the offending line is {{ page.content | safe }}
and I can’t figure out how to have content/index.md rendered using this.
oh and my content/index.md looks like this:
+++
title = "Home"
date = 2020-08-01T19:31:27+02:00
description = "Foobar"
draft = true
toc = false
page_template = "home.html"
+++
hello world from index.md
Originally I tried the after-dark theme to make it behave like this but I noticed that in its documentation it already made clear that it assumed paginate_by = 5 must be set when using this theme. In case anyone has some working examples it would be :chefs kiss:
thanks for any pointers - much appreciated.
cheers