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 }} {{ end }}
{{ block "footer" . }} {{ block "footer" . }}
<script src="/js/dark.js" defer="" ></script>
<!-- More shared code, perhaps a footer but that can be overridden if need be in --> <!-- More shared code, perhaps a footer but that can be overridden if need be in -->
<script src="/js/dark.js" defer="" ></script>
{{ end }} {{ end }}
</body> </body>
</html> </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> <h3>Posts</h3>
<div> <div>
<!-- orders content according to the "publishdate" field in front matter --> <!-- orders content according to the "publishdate" field in front matter -->
{{ range first (.Site.Params.PostLimit | default 4) (where .Site.RegularPages.ByPublishDate "Section" "posts") }} {{ range first (.Site.Params.PostLimit | default 4) (where .Site.RegularPages.ByPublishDate "Section" "posts") }}
<div> <div>
@ -40,9 +39,12 @@
<br /> <br />
{{ end }} {{ end }}
<hr>
<h3><a href="posts/">View all posts</a></h3> <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> </div>
</body> </body>
<script src="/js/dark.js" defer="" ></script>
</html> </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> <footer>
<div> <div>
<h3><a href="{{ .Site.BaseURL }}posts">Back to all posts</a></h3> <h3><a href="{{ .Site.BaseURL }}posts">Back to all posts</a></h3>
</div> </div>
<hr> <hr>
<p>Go <a href="{{ .Site.BaseURL }}/index.xml">here</a> for an RSS feed.</p> <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> <script src="/js/dark.js" defer="" ></script>
</footer> </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; 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;
}