master
Zach Leatherman 2020-10-16 13:06:30 -05:00
parent 61885752b6
commit d28f834fbb
2 changed files with 6 additions and 1 deletions

View File

@ -33,6 +33,10 @@ module.exports = function(eleventyConfig) {
return array.slice(0, n);
});
eleventyConfig.addFilter("min", (...numbers) => {
return Math.min.apply(null, numbers);
});
eleventyConfig.addCollection("tagList", function(collection) {
let tagSet = new Set();
collection.getAll().forEach(function(item) {

View File

@ -5,7 +5,8 @@ eleventyNavigation:
order: 1
---
<h1>Latest 3 Posts</h1>
{% set maxPosts = collections.posts.length | min(3) %}
<h1>Latest {% if maxPosts == 1 %}Post{% else %}{{ maxPosts }} Posts{% endif %}</h1>
{% set postslist = collections.posts | head(-3) %}
{% set postslistCounter = collections.posts | length %}