Add tags functionality

This commit is contained in:
Sam 2024-08-08 23:18:52 +01:00
parent ad05385853
commit ddc1de0909
3 changed files with 61 additions and 5 deletions

View File

@ -6,19 +6,39 @@
</div>
<div class="article-card-container">
{{ range.Pages }}
<a class="article-card" href="{{ .RelPermalink }}">
<div class="article-card">
<div class="article-card-info">
<img class="article-card-thumbnail" src="{{ .Params.header_image }}" />
<div class="article-card-thumb">
<a href="{{ .RelPermalink }}">
<img
class="article-card-thumbnail"
src="{{ .Params.header_image }}"
/>
</a>
</div>
<div class="article-card-summary">
{{ template "partials/get-tags.html" . }}
<a href="{{ .RelPermalink }}">
<h3><strong>{{ .Title | safeHTML }}</strong></h3>
<p>{{ .Summary | safeHTML }}</p>
</a>
<p>
{{ .Summary | safeHTML }}
<i class="reading-time"
>({{ .ReadingTime }} minute{{ if (ne .ReadingTime 1) }}s{{ end
}})</i
>
</p>
<br />
<div class="article-card-author-row">
{{ with .Params.author }}
<strong><p class="author-name">{{ .name }}</p></strong>
{{ end }}
<time>{{ .Date.Format "January 2, 2006" }}</time>
</div>
</div>
</div>
</a>
</div>
{{ end }}
</div>
</div>

View File

@ -0,0 +1,6 @@
<div class="tags-container">
{{ with .Param "tags" }} {{ range $index, $tag := (. | sort) }} {{ with
$.Site.GetPage (printf "/%s/%s" "tags" $tag) }}
<a a href="{{ .Permalink }}">{{ $tag | urlize }}</a>
{{ end }} {{ end }} {{ end }}
</div>

30
layouts/taxonomy/tag.html Normal file
View File

@ -0,0 +1,30 @@
{{ define "main" }}
<div class="list-content-container">
<div class="page-content">
<h1>{{ .Title }}</h1>
{{ .Content }}
</div>
<div class="article-card-container">
{{ range.Pages }}
<a class="article-card" href="{{ .RelPermalink }}">
<div class="article-card-info">
<div class="article-card-thumb">
<img
class="article-card-thumbnail"
src="{{ .Params.header_image }}"
/>
</div>
<div class="article-card-summary">
<h3><strong>{{ .Title | safeHTML }}</strong></h3>
<p>{{ .Summary | safeHTML }}</p>
<br />
<div class="article-card-author-row">
<time>{{ .Date.Format "January 2, 2006" }}</time>
</div>
</div>
</div>
</a>
{{ end }}
</div>
</div>
{{ end }}