Breadcrumbs and tags

This commit is contained in:
Francesco 2024-05-11 22:48:26 +02:00
parent f769a715ef
commit 34f9485c99
4 changed files with 42 additions and 12 deletions

View File

@ -105,7 +105,9 @@ The fonts in use are [Literata](https://fonts.google.com/specimen/Literata) and
Various miscellaneous features: Various miscellaneous features:
- Latex blocks overflows on mobile to prevent having strange alignments; - Latex blocks overflows on mobile to prevent having strange alignments;
- Code blocks are displayed with ligatures; - Code blocks are displayed with ligatures;
- [Giscus](https://giscus.app/) comments support. - [Giscus](https://giscus.app/) comments support;
- Breadcrumbs;
- Tags and ability to not show them on posts.
### 2.6 Extending the theme ### 2.6 Extending the theme
@ -125,6 +127,8 @@ toc: true
readTime: true readTime: true
autonumber: true autonumber: true
math: true math: true
tags: ["information-retrieval", "rust"]
showTags: false
--- ---
Your content... Your content...
@ -138,9 +142,6 @@ languageCode = 'en-us'
title = 'Title' title = 'Title'
theme = 'Typo' theme = 'Typo'
# Disable tags, actually, they are rendered as a list, but the idea is to disable them.
disableKinds = ['taxonomy']
# Google analytics code # Google analytics code
googleAnalytics = "G-xxxxxxxxxx" googleAnalytics = "G-xxxxxxxxxx"
@ -168,6 +169,9 @@ listSummaries = true
# List entries date format # List entries date format
listDateFormat = '2 Jan 2006' listDateFormat = '2 Jan 2006'
# Breadcrumbs
breadcrumbs = true
# Social icons # Social icons
[[params.social]] [[params.social]]
name = "linkedin" name = "linkedin"
@ -225,5 +229,4 @@ Leave a star if you are using the theme, I would really appreciate! :star:
## 6 Future Works ## 6 Future Works
- [ ] Bring SEO and [performance metrics](https://pagespeed.web.dev/) to 100% both on mobile and desktop; - [ ] Bring SEO and [performance metrics](https://pagespeed.web.dev/) to 100% both on mobile and desktop;
- [ ] Add color palettes; - [ ] Add color palettes.
- [ ] Add a proper Tags page;

View File

@ -265,6 +265,14 @@ footer a {
margin-bottom: 6rem; margin-bottom: 6rem;
} }
.single-tags {
margin-top: -1rem;
}
.single-tags span {
margin-right: .3rem;
}
/* Table of contents */ /* Table of contents */
.toc { .toc {
@ -346,4 +354,5 @@ footer a {
.breadcrumbs { .breadcrumbs {
/* font-family: "Monaspace"; */ /* font-family: "Monaspace"; */
font-size: small; font-size: small;
margin-bottom: calc(-0.5 * var(--h1-margin-top));
} }

View File

@ -6,7 +6,7 @@
<div {{ if .Param "autonumber" }} class="autonumber" {{ end }}> <div {{ if .Param "autonumber" }} class="autonumber" {{ end }}>
<div class=" single-intro-container"> <div class="single-intro-container">
{{/* Title and Summary */}} {{/* Title and Summary */}}
@ -32,11 +32,28 @@
</div> </div>
{{/* {{ .Params.tags }} */}} {{ if .Param "showTags" }}
{{ $taxonomy := "tags" }}
{{ with .Param $taxonomy }}
{{ $last := sub (. | len) 1 }}
<div class="single-tags">
{{ range $index, $tag := . }}
{{ with $.Site.GetPage (printf "/%s/%s" $taxonomy $tag) -}}
<span>
<a href="{{ .Permalink }}">#{{ $tag | urlize }}</a>
</span>
{{ end }}
{{ end }}
</div>
{{ end }}
{{ end }}
{{/* Table of Content */}} {{/* Table of Content */}}
{{if .Param "toc" }} {{ if .Param "toc" }}
<aside class="toc"> <aside class="toc">
<p><strong>Table of contents</strong></p> <p><strong>Table of contents</strong></p>
{{ .TableOfContents }} {{ .TableOfContents }}

View File

@ -1,8 +1,9 @@
{{ if .Site.Params.breadcrumbs }}
<div class="breadcrumbs"> <div class="breadcrumbs">
{{ range .Ancestors.Reverse }} {{ range .Ancestors.Reverse }}
<a href="{{ .RelPermalink }}">{{ .Title }}</a> <a href="{{ .RelPermalink }}">{{ .Title }}</a>
<span class="breadcrumbs-separator"> > </span> <span class="breadcrumbs-separator"> > </span>
{{ end }} {{ end }}
<a class="breadcrumbs-current" href="{{ .RelPermalink }}">{{ .Title }}</a>
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
</div> </div>
{{ end }}