home: Add links to headings

This commit is contained in:
jtbx 2023-10-22 00:17:53 +02:00
parent eab3b281c0
commit 9f8c0d30e9
2 changed files with 15 additions and 2 deletions

View file

@ -30,6 +30,18 @@ body>main {
padding-bottom: var(--spacing);
}
.small {
font-size: 0.7em;
}
.on-hover {
display: none;
}
.on-hover-trg:hover .on-hover {
display: initial;
}
.li-comma {
&::after {
content: ", ";

View file

@ -8,7 +8,7 @@
{{- $upcoming := where $events ".Params.date" "ge" now }}
{{ if $upcoming }}
<div class="announcements">
<h2>Neuigkeiten</h2>
<h2 id="neuigkeiten" class="on-hover-trg">Neuigkeiten <a href="#neuigkeiten" class="on-hover"><i class="fa-solid fa-link small"></i></a></h2>
{{- range $upcoming.ByDate }}
<div class="announcement">
{{- partial "blog-header.html" (dict "headingLink" true "level" 4 "reduced" true "page" . ) }}
@ -27,7 +27,8 @@
{{- $sections := where ($home.Resources.ByType "page") ".File.LogicalName" "index.md" }}
{{- range sort $sections "File.Path" "asc" }}
<div class="section">
<h2>{{ .Title }}</h2>
{{- $hdg_id := .Title | lower | safeURL }}
<h2 id="{{ $hdg_id }}" class="on-hover-trg">{{ .Title }} <a href="#{{ $hdg_id }}" class="on-hover"><i class="fa-solid fa-link small"></i></a></h2>
{{ .Content -}}
{{- $subsec_dir := strings.TrimLeft "home/" .File.Dir }}