generated from voightco/static-site-starter
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
module.exports = function(collection) { | ||
let tagSet = new Set(); | ||
collection.getAll().forEach(function(item) { | ||
if( "tags" in item.data ) { | ||
let tags = item.data.tags; | ||
|
||
tags = tags.filter(function(item) { | ||
switch(item) { | ||
// this list should match the `filter` list in tags.njk | ||
case "all": | ||
case "nav": | ||
case "post": | ||
case "posts": | ||
case "tagList": | ||
case "link": | ||
case "guide": | ||
case "note": | ||
case "weeknote": | ||
case "journal": | ||
case "project": | ||
case "talks": | ||
case "article": | ||
case "essay": | ||
return false; | ||
} | ||
|
||
return true; | ||
}); | ||
|
||
for (const tag of tags) { | ||
tagSet.add(tag); | ||
} | ||
} | ||
}); | ||
|
||
// returning an array in addCollection works in Eleventy 0.5.3 | ||
return [...tagSet]; | ||
}; |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
layout: layouts/default | ||
permalink: /tags/ | ||
title: All tags | ||
--- | ||
|
||
{% for tag in collections.tagList %} | ||
{% set tagUrl %}/tags/{{ tag }}/{% endset %} | ||
<a href="{{ tagUrl | url }}" class="tag">{{ tag }}</a> | ||
{% endfor %} | ||
|
||
<p>See <a href="{{ '/tags/' | url }}">all tags</a>.</p> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
pagination: | ||
data: collections | ||
size: 1 | ||
alias: tag | ||
filter: | ||
- all | ||
- nav | ||
- post | ||
- posts | ||
- note | ||
- weeknote | ||
- project | ||
- journal | ||
- guide | ||
- essay | ||
- link | ||
- tagList | ||
- talks | ||
- article | ||
addAllPagesToCollections: true | ||
layout: layouts/default | ||
renderData: | ||
title: Tagged “{{ tag }}” | ||
permalink: /tags/{{ tag }}/ | ||
--- | ||
<h1>Tagged “{{ tag }}”</h1> | ||
|
||
<ol> | ||
{% set taglist = collections[ tag ] %} | ||
{% for post in taglist | reverse %} | ||
<li><a href="{{ post.url | url }}">{{ post.data.title }}</a></li> | ||
{% endfor %} | ||
</ol> | ||
|
||
<p>See <a href="{{ '/tags/' | url }}">all tags</a>.</p> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
title: Tech Review | ||
subtitle: I've been working on this very website for quite some time. | ||
description: I've been working on this very website for quite some time but always felt it was not finished. | ||
slug: tech-review | ||
date: 2019-09-06 | ||
tags: ['article', 'tech'] | ||
layout: layouts/post.njk | ||
permalink: /articles/{{ slug }}/index.html | ||
--- |