Please note that this version of the site is no longer being updated. All content has been merged with my IT Blog "Much Ado About IT". Click here to see this page on the other site. I've found that using Jekyll to be too fragile and complex. GitHub pages are too limited. The blog site was on WordPress (self-hosted) but that was too slow and clunky. The revamped blog now uses Hugo and is published using Netlify
How to generate a list of pages in a given folder
page_lister.html include file
Create this as a file in your _includes folder
{% assign dir = include.dir | default: page.dir %}
<div class="page-list">
{% assign mypages = site.pages | where:"dir", dir | where_exp:"item", "item.name != page.name" %}
{% if mypages.length > 0 %}
<ul>
{% for item in mypages | sort: "title" %}
{% assign mytitle = item.title | default: item.url %}
<li>
<a href="{{ item.url }}">{{ mytitle | replace:'_',' ' | replace:'-',' ' }}</a>
<p>{% if item.description %}
{{ item.description }}
{% else %}
{{ item.excerpt | strip_html }}
{% endif %}</p>
</li>
{% endfor %}
</ul>
{% else %}
<p>No pages found in folder <code>{{ dir }}</code>.</p>
{% endif %}
</div>
Using the include file
To use, place the following code wherever you want a list of the output files - such as the index.md for the collection folder.
{% include page_lister.html dir="/vscode/" %}
Note the reference to the folder directory name (with leading/trailing slashes as per the .dir
attribute) which is passed to the include file.