add: pipeline categorization by metadata key
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -7,6 +7,6 @@
|
||||
<title>{{- if .Title -}}{{ .Title }} | {{ else }}{{ end -}} My Blog</title>
|
||||
</head>
|
||||
<body>
|
||||
{{- .Content -}}
|
||||
{{ .Content }}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -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>
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user