Compare commits
5 commits
b929fb7225
...
95d0a93709
| Author | SHA1 | Date | |
|---|---|---|---|
| 95d0a93709 | |||
| 2e006c00b2 | |||
| 24e6abb811 | |||
| 8a22c5e7a9 | |||
| 08f0ec496f |
3 changed files with 37 additions and 3 deletions
|
|
@ -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));
|
||||
};
|
||||
|
|
|
|||
8
_includes/blog_sidebar.njk
Normal file
8
_includes/blog_sidebar.njk
Normal 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>
|
||||
|
|
@ -5,6 +5,8 @@
|
|||
}
|
||||
],
|
||||
"settings": {
|
||||
"liveServer.settings.root": "/_site/"
|
||||
"liveServer.settings.root": "/_site/",
|
||||
"liveServer.settings.host": "yuki.last.fm",
|
||||
"liveServer.settings.port": 80
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue