We don’t need to manage this tags list in two places.
This commit is contained in:
parent
dd1b821a8b
commit
4a10406051
@ -41,10 +41,11 @@ module.exports = function(eleventyConfig) {
|
|||||||
return Math.min.apply(null, numbers);
|
return Math.min.apply(null, numbers);
|
||||||
});
|
});
|
||||||
|
|
||||||
eleventyConfig.addFilter("filterTagList", tags => {
|
function filterTagList(tags) {
|
||||||
// should match the list in tags.njk
|
|
||||||
return (tags || []).filter(tag => ["all", "nav", "post", "posts"].indexOf(tag) === -1);
|
return (tags || []).filter(tag => ["all", "nav", "post", "posts"].indexOf(tag) === -1);
|
||||||
})
|
}
|
||||||
|
|
||||||
|
eleventyConfig.addFilter("filterTagList", filterTagList)
|
||||||
|
|
||||||
// Create an array of all tags
|
// Create an array of all tags
|
||||||
eleventyConfig.addCollection("tagList", function(collection) {
|
eleventyConfig.addCollection("tagList", function(collection) {
|
||||||
@ -53,7 +54,7 @@ module.exports = function(eleventyConfig) {
|
|||||||
(item.data.tags || []).forEach(tag => tagSet.add(tag));
|
(item.data.tags || []).forEach(tag => tagSet.add(tag));
|
||||||
});
|
});
|
||||||
|
|
||||||
return [...tagSet];
|
return filterTagList([...tagSet]);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Copy the `img` and `css` folders to the output
|
// Copy the `img` and `css` folders to the output
|
||||||
|
@ -4,6 +4,7 @@ description: This is a post on My Blog about win-win survival strategies.
|
|||||||
date: 2018-08-24
|
date: 2018-08-24
|
||||||
tags:
|
tags:
|
||||||
- second tag
|
- second tag
|
||||||
|
- posts with two tags
|
||||||
layout: layouts/post.njk
|
layout: layouts/post.njk
|
||||||
---
|
---
|
||||||
Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment.
|
Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment.
|
||||||
|
@ -4,7 +4,7 @@ layout: layouts/home.njk
|
|||||||
---
|
---
|
||||||
<h1>Tags</h1>
|
<h1>Tags</h1>
|
||||||
|
|
||||||
{% for tag in collections.tagList | filterTagList %}
|
{% for tag in collections.tagList %}
|
||||||
{% set tagUrl %}/tags/{{ tag | slug }}/{% endset %}
|
{% set tagUrl %}/tags/{{ tag | slug }}/{% endset %}
|
||||||
<a href="{{ tagUrl | url }}" class="post-tag">{{ tag }}</a>
|
<a href="{{ tagUrl | url }}" class="post-tag">{{ tag }}</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
Loading…
Reference in New Issue
Block a user