Alphabetizes tags page

This commit is contained in:
P. Douglas Reeder 2023-04-22 02:26:22 -04:00
parent 4f0a64d781
commit 87200eb4eb
2 changed files with 5 additions and 1 deletions

View file

@ -5,7 +5,7 @@ layout: layouts/home.njk
<h1>Tags</h1>
<ul>
{% for tag in collections.all | getAllTags | filterTagList %}
{% for tag in collections.all | getAllTags | filterTagList | sortAlphabetically %}
{% set tagUrl %}/tags/{{ tag | slugify }}/{% endset %}
<li><a href="{{ tagUrl }}" class="post-tag">{{ tag }}</a></li>
{% endfor %}

View file

@ -78,6 +78,10 @@ module.exports = function(eleventyConfig) {
return (tags || []).filter(tag => ["all", "nav", "post", "posts"].indexOf(tag) === -1);
});
eleventyConfig.addFilter("sortAlphabetically", strings =>
(strings || []).sort((b, a) => b.localeCompare(a))
);
// Customize Markdown library settings:
eleventyConfig.amendLibrary("md", mdLib => {
mdLib.use(markdownItAnchor, {