Compare commits

...

5 commits

Author SHA1 Message Date
95d0a93709
extremely important live server config 2025-10-19 08:43:59 -03:00
2e006c00b2
add blog sidebar 2025-10-18 10:40:54 -03:00
24e6abb811
fix and rename exclude_tags to exclude_collections 2025-10-18 10:38:15 -03:00
8a22c5e7a9
add exclude_tags filter 2025-10-18 10:27:11 -03:00
08f0ec496f
add object keys filter 2025-10-18 10:14:26 -03:00
3 changed files with 37 additions and 3 deletions

View file

@ -34,6 +34,29 @@ module.exports = function (eleventyConfig, { TIME_ZONE, defaultLanguage }) {
return filtered;
});
// takes all collections and returns only the tags not matched
// key-objects so may repurpose under different name
eleventyConfig.addFilter("exclude_collections", function (collections, ...keysToExclude) {
if (!collections || typeof collections !== "object") {
console.warn("[exclude_collections] Invalid collections input:", collections);
return collections;
}
const result = {};
Object.keys(collections).forEach(key => {
if (!keysToExclude.includes(key)) {
result[key] = collections[key];
}
});
if (process.env.LOCALE_URL_DEBUG === "1" || process.env.LOCALE_URL_DEBUG === "true") {
console.warn("[excludeCollections] Excluded keys:", keysToExclude);
console.warn("[excludeCollections] Resulting keys:", Object.keys(result));
}
return result;
});
const LOCALE_URL_DEBUG = process.env.LOCALE_URL_DEBUG === "1" || process.env.LOCALE_URL_DEBUG === "true";
// locale_url replacement that uses pre-compile filesystem
@ -129,6 +152,7 @@ module.exports = function (eleventyConfig, { TIME_ZONE, defaultLanguage }) {
return fallback2;
});
// turn on disabled nunjucks filter
eleventyConfig.addNunjucksFilter("values", obj => Object.values(obj));
// turn on disabled nunjucks filters
eleventyConfig.addFilter("keys", obj => Object.keys(obj));
eleventyConfig.addFilter("values", obj => Object.values(obj));
};

View file

@ -0,0 +1,8 @@
<div class="tag-list-wrapper box">
<h2>tags</h2>
<ul class="tag-list">
{% for tag, posts in collections | exclude_collections("reviews", "all") %}
<li class="tag-item"><p>{{ tag | i18n }} ({{ posts | i18n_filter | length }})</p></li>
{% endfor %}
</ul>
</div>

View file

@ -5,6 +5,8 @@
}
],
"settings": {
"liveServer.settings.root": "/_site/"
"liveServer.settings.root": "/_site/",
"liveServer.settings.host": "yuki.last.fm",
"liveServer.settings.port": 80
}
}