Here's a way I did it. Probably there is a better way.
Add a page to each directory (I used the file name "list_title.md") with the metadata:
list_title = "Heading for the navigation links for this directory"
do_not_list = "True"
In conf.py, define a context variable with the name that was used for the page file with the metadata:
GLOBAL_CONTEXT = {
...
'LIST_TITLE_FILENAME': 'list_title.md',
}
In base_header.tmpl, add the macros:
{# Return the title to use for the navigation links for the directory in which #}
{# link is found by looking for the metadata "list_title" in LIST_TITLE_FILENAME file #}
{% macro html_navigation_links_title(link) %}
{% set filename = link.split('/')[-2] + ".md" %}
{% set file_path = link[:-1] + ".md"%}
{% if filename == LIST_TITLE_FILENAME %}
{% set full_file_path = os.path.realpath("pages/" + file_path) %}
{% set f = open(full_file_path, 'r') %}
{% set file_contents = f.read() %}
{% set metadata = toml.loads(file_contents.split('+++')[1]) %}
<h1>{{ metadata['list_title'] }}</h1>
{% endif %}
{% endmacro %}
{# Return listing for the link if the value of link's do_not_list metadata field is not True #}
{% macro list_link(link, text) %}
{% set filename = link.split('/')[-2] + ".md" %}
{% set file_path = link[:-1] + ".md"%}
{% set full_file_path = os.path.realpath("pages/" + file_path) %}
{% set f = open(full_file_path, 'r') %}
{% set file_contents = f.read() %}
{% set metadata = toml.loads(file_contents.split('+++')[1]) %}
{% if metadata['do_not_list'] != "True" %}
<li><a href="{{ link }}">{{ text|e }}</a></li>
{% endif %}
{% endmacro %}
In list.tmpl, modify the for loop to use the macros:
<ul class="postlist">
{% for text, link, count in items %}
{{ header.html_navigation_links_title(link) }}
{{ header.list_link(link, text) }}
{% if count %}
({{ count }})
{% endif %}
{% endfor %}
</ul>