I would like to be able to add to the list of published articles only documents that contain the variable publish = true
in the file header.
I have added to each article the following lines in the header: foo.md:
+++
title = "Foo"
date = 2022-06-03
publish = true
+++
bar.md:
+++
title = "Bar"
date = 2022-06-03
publish = false
+++
This is the code I have tried to use in my index.html for Zola:
<h2 id="Articles">Articles</h2>
<ul class="articles">
{% set section = get_section(path="blog/_index.md") %}
{% for page in section.pages %}
{% if page.publish %}
<li>
<a href="{{ page.permalink | safe }}">{{ page.title }}</a>
<p class="date">{{ page.date }}</p>
</li>
{% endif %}
{% endfor %}