mirror of
https://github.com/praktimarc/kst4contest.git
synced 2026-07-14 00:26:52 +02:00
Add ordered and featured feature collections
This commit is contained in:
@@ -28,6 +28,20 @@ function rewriteManualLinks(content, lang) {
|
||||
|
||||
module.exports = function (eleventyConfig) {
|
||||
|
||||
eleventyConfig.addCollection("sortedFeatures", function (collectionApi) {
|
||||
return collectionApi.getFilteredByTag("features").sort((a, b) => {
|
||||
return (a.data.order || 999) - (b.data.order || 999);
|
||||
});
|
||||
});
|
||||
|
||||
eleventyConfig.addCollection("featuredFeatures", function (collectionApi) {
|
||||
return collectionApi.getFilteredByTag("features")
|
||||
.filter(item => item.data.featured)
|
||||
.sort((a, b) => {
|
||||
return (a.data.order || 999) - (b.data.order || 999);
|
||||
});
|
||||
});
|
||||
|
||||
eleventyConfig.addFilter("whereTag", function(collection, tag) {
|
||||
return collection.filter(item => item.data.tags && item.data.tags.includes(tag));
|
||||
});
|
||||
|
||||
@@ -27,7 +27,7 @@ layout: base.njk
|
||||
<h2>Related features</h2>
|
||||
<div class="actions">
|
||||
{% for slug in related %}
|
||||
{% for item in collections.features %}
|
||||
{% for item in collections.sortedFeatures %}
|
||||
{% if item.fileSlug == slug %}
|
||||
<a class="button secondary" href="{{ item.url }}">{{ item.data.title }}</a>
|
||||
{% endif %}
|
||||
|
||||
@@ -28,7 +28,7 @@ description: KST4Contest is a modern ON4KST chat client built for VHF, UHF and S
|
||||
</div>
|
||||
|
||||
<div class="mock-grid">
|
||||
{% for feature in collections.features %}
|
||||
{% for feature in collections.sortedFeatures %}
|
||||
{% if loop.index <= 6 %}
|
||||
<div class="mini-card">
|
||||
<strong>{{ feature.data.icon }} {{ feature.data.title }}</strong>
|
||||
|
||||
Reference in New Issue
Block a user