add: pipeline categorization by metadata key

This commit is contained in:
2022-12-31 16:37:17 +01:00
parent 46715cf033
commit 165fffe91b
13 changed files with 261 additions and 24 deletions
+10 -1
View File
@@ -10,5 +10,14 @@ build:
- use: layout
path: layouts/base.html
- target: dist/posts/{id}/index.html
- pipeline:
- source: posts/{id}.md
- use: frontmatter
- use: categorize
key: tags
- use: layout
path: layouts/tag.html
- use: layout
path: layouts/base.html
- target: dist/tags/{{ .Category }}/index.html
+1 -1
View File
@@ -7,6 +7,6 @@
<title>{{- if .Title -}}{{ .Title }} | {{ else }}{{ end -}} My Blog</title>
</head>
<body>
{{- .Content -}}
{{ .Content }}
</body>
</html>
+12
View File
@@ -0,0 +1,12 @@
<h1>Tag #{{ .Category }}</h1>
<p>Here are the posts with this tag</p>
<ul>
{{ range .Items }}
<li>
<p>{{ .Metadata.Title }}</p>
<pre><code>{{ .Metadata.MatchResult }}</code></pre>
</li>
{{ end }}
</ul>
+1
View File
@@ -2,6 +2,7 @@
title: First Post
description: Lorem ipsum dolor sit amet consectetur adipisicing elit.
publish_date: 2022-12-22 11:00
tags: [a, b]
---
# First Post
+1
View File
@@ -2,6 +2,7 @@
title: Second Post
description: Lorem ipsum dolor sit amet consectetur adipisicing elit.
publish_date: 2022-12-22 11:00
tags: [b, c]
---
# Second Post
+1
View File
@@ -2,6 +2,7 @@
title: Third Post
description: Lorem ipsum dolor sit amet consectetur adipisicing elit.
publish_date: 2022-12-22 11:00
tags: [a]
---
# Third Post