feat[taxonomy] Added tags and categories

Added template files for tags and categories.
Updated css themes to something crappy.
This commit is contained in:
Judah Sotomayor 2023-10-15 22:00:24 -04:00
parent 657f0a0474
commit 7c892580b5
8 changed files with 126 additions and 56 deletions

View File

@ -16,8 +16,8 @@
{{ end }}
{{ block "footer" . }}
<script src="/js/dark.js" defer="" ></script>
<!-- More shared code, perhaps a footer but that can be overridden if need be in -->
<script src="/js/dark.js" defer="" ></script>
{{ end }}
</body>
</html>

View File

@ -0,0 +1,13 @@
{{ define "main" }}
<ul>
{{range .Data.Pages}}
<li>
<a href="{{.RelPermalink}}">{{.Title}}</a>
</li>
{{end}}
</ul>
<div>
<h3><a href="{{ .Site.BaseURL }}categories">Back to all categories</a></h3>
</div>
{{ end }}

13
layouts/_default/tag.html Normal file
View File

@ -0,0 +1,13 @@
{{ define "main" }}
<ul>
{{range .Data.Pages}}
<li>
<a href="{{.RelPermalink}}">{{.Title}}</a>
</li>
{{end}}
</ul>
<div>
<h3><a href="{{ .Site.BaseURL }}tags">Back to all tags</a></h3>
</div>
{{ end }}

View File

@ -30,7 +30,6 @@
<h3>Posts</h3>
<div>
<!-- orders content according to the "publishdate" field in front matter -->
{{ range first (.Site.Params.PostLimit | default 4) (where .Site.RegularPages.ByPublishDate "Section" "posts") }}
<div>
@ -40,9 +39,12 @@
<br />
{{ end }}
<hr>
<h3><a href="posts/">View all posts</a></h3>
<h3><a href="categories/"> View all categories</a></h3>
<h3><a href="tags/"> View all tags</a></h3>
</div>
</body>
<script src="/js/dark.js" defer="" ></script>
</html>

View File

@ -0,0 +1,11 @@
{{ $taxonomy := "categories" }}
{{ with .GetTerms $taxonomy }}
<p class="taglist">
{{ (site.GetPage $taxonomy).LinkTitle }}:
{{ range $k, $_ := . -}}
{{ if $k }}, {{ end }}
<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
{{- end }}
</p>
{{ end }}

View File

@ -1,8 +1,13 @@
<footer>
<div>
<h3><a href="{{ .Site.BaseURL }}posts">Back to all posts</a></h3>
</div>
<hr>
<p>Go <a href="{{ .Site.BaseURL }}/index.xml">here</a> for an RSS feed.</p>
{{partial "tags.html" .}}
{{partial "categories.html" .}}
<script src="/js/dark.js" defer="" ></script>
</footer>

View File

@ -0,0 +1,11 @@
{{ $taxonomy := "tags" }}
{{ with .GetTerms $taxonomy }}
<p class="taglist">
{{ (site.GetPage $taxonomy).LinkTitle }}:
{{ range $k, $_ := . -}}
{{ if $k }}, {{ end }}
<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
{{- end }}
</p>
{{ end }}

View File

@ -40,3 +40,18 @@ hr {
border: 1px solid #eee;
}
highlight {
}
pre code span span{
word-break: break-all;
white-space: pre-wrap;
}
.taglist {
border: solid;
border-weight: 2pt;
padding: 4pt;
}