Last active
March 6, 2021 19:54
-
-
Save meyerweb/2a9d2fec59bff40dcb64dfcc498ddba7 to your computer and use it in GitHub Desktop.
Eleventy problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// !!!!! the next two functions do NOT break release.md !!!!! | |
eleventyConfig.addCollection("tagList", collection => { | |
const tagsSet = new Set(); | |
collection.getAll().forEach(item => { | |
if (!item.data.tags) return; | |
item.data.tags | |
.filter(tag => !['post', 'all'].includes(tag)) | |
.forEach(tag => tagsSet.add(tag)); | |
}); | |
return Array.from(tagsSet).sort(); | |
}); | |
eleventyConfig.addCollection("pkgList", collection => { | |
const pkgsSet = new Object; | |
collection.getAll().forEach(item => { | |
if (!item.data.package) return; | |
if (pkgsSet[item.data.package]) return; | |
pkgsSet[item.data.package] = {}; | |
}) | |
// for (val in pkgsSet) { | |
// pkgsSet[val] = {"pkg": val}; | |
// }; | |
return pkgsSet; | |
}); | |
// !!!!! the next function BREAKS release.md !!!!! | |
eleventyConfig.addCollection("testList", collection => { | |
const testSet = new Object; | |
collection.getFilteredByTags("release").forEach(item => { | |
const data = item.data; | |
if (!data.package) return; | |
if (!testSet[data.package]) testSet[data.package] = new Object; | |
testSet[data.package] = {...testSet[data.package], ...item.data}; | |
}) | |
return testSet; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: Releases | |
layout: page | |
pagination: | |
data: collections.release | |
size: 50 | |
alias: posts | |
--- | |
<section class="content-section bg-primary text-white small-section"> | |
<div class="container text-center"> | |
<div class="content-section-heading"> | |
<h2>Release Announcements</h2> | |
</div> | |
</div> | |
</section> | |
<section class="content-section bg-light small-section"> | |
<div class="container text-center"> | |
<div class="row"> | |
<div class="col-lg-10 mx-auto lead text-left"> | |
<p> {{ collections.tagList }} | |
<p> {{ collections.pkgList }} | |
<p> {{ collections.testList }} | |
<h2>Stable</h2> | |
{%- for post in collections.stableReleaseNotes -%} | |
<h3 class="release-heading"><a href="{{ post.url | url }}">{{ post.data.title }}</a></h3>{{ post.date | dateString }} | |
| <strong>{{ post.data.package }}</strong> | |
| {{ post.data.version }} | |
| {{ post.data.tags }} | |
{%- endfor -%} | |
<h2>Unstable</h2> | |
{%- for post in collections.unstableReleaseNotes -%} | |
<h3 class="release-heading"><a href="{{ post.url | url }}">{{ post.data.title }}</a></h3>{{ post.date | dateString }} | |
| <strong>{{ post.data.package }}</strong> | |
| {{ post.data.version }} | |
| {{ post.data.tags }} | |
{%- endfor -%} | |
<h3>Latest Releases</h3> | |
{%- for release in collections.latestReleases -%} | |
<h4>{{ release[0] }}</h4> | |
{%- for type in release[1] -%} | |
<p>{{ type[1].version }} {{ type[0] }}</p> | |
{%- endfor -%} | |
{%- endfor -%} | |
<hr> | |
<p> {{ collections.packageList }} | |
<p> {{ collections.latestReleases }} | |
</div> | |
</div> | |
</div> | |
</section> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment