Adds anchors to all headings (#439)

This commit is contained in:
Codruț Constantin Gușoi
2021-01-25 20:13:58 +00:00
committed by GitHub
parent 2ae5eec336
commit 8384e09033
12 changed files with 74 additions and 13 deletions

View File

@@ -0,0 +1,6 @@
<h{{ .Level }} id="{{ .Anchor | safeURL }}">
{{ .Text | safeHTML }}
<a class="heading-link" href="#{{ .Anchor | safeURL }}">
<i class="fa fa-link" aria-hidden="true"></i>
</a>
</h{{ .Level }}>

View File

@@ -1,11 +1,13 @@
<section class="container list">
<h1 class="title">
{{- if eq .Kind "term" -}}
{{- i18n .Data.Singular | title -}}
{{- print ": " -}}
{{- end -}}
<a class="title-link" href="{{ .Permalink | safeURL }}">
{{- if eq .Kind "term" -}}
{{- i18n .Data.Singular | title -}}
{{- print ": " -}}
{{- end -}}
{{- .Title -}}
{{- .Title -}}
</a>
</h1>
{{ .Content }}
<ul>

View File

@@ -1,7 +1,11 @@
<section class="container page">
<article>
<header>
<h1>{{ .Title }}</h1>
<h1 class="title">
<a class="title-link" href="{{ .Permalink | safeURL }}">
{{ .Title }}
</a>
</h1>
</header>
{{ .Content }}

View File

@@ -5,7 +5,12 @@
{{ $name := . | urlize }}
{{ $series := index $.Site.Taxonomies.series $name }}
{{ if gt (len $series.Pages) 1 }}
<h3>{{ i18n "see_also" | default "See also in" }} {{ . }}</h3>
<h3 id="{{ i18n "see_also" | default "See also in" | anchorize }}-{{ anchorize . | safeURL }}">
{{ i18n "see_also" | default "See also in" }} {{ . }}
<a class="heading-link" href="#{{ i18n "see_also" | default "See also in" | anchorize }}-{{ anchorize . | safeURL }}">
<i class="fa fa-link" aria-hidden="true"></i>
</a>
</h3>
<nav>
<ul>
{{ $maxItems := $.Site.Params.maxSeeAlsoItems | default 5 }}

View File

@@ -3,7 +3,11 @@
{{ end }}
{{ define "content" }}
<section class="container list">
<h1 class="title"> {{ title (i18n (lower .Title)) | default .Title }} </h1>
<h1 class="title">
<a class="title-link" href="{{ .Permalink | safeURL }}">
{{ title (i18n (lower .Title)) | default .Title }}
</a>
</h1>
{{ .Content }}
<ul>
{{- range .Paginator.Pages -}}

View File

@@ -6,7 +6,11 @@
<article>
<header>
<div class="post-title">
<h1 class="title">{{ .Title }}</h1>
<h1 class="title">
<a class="title-link" href="{{ .Permalink | safeURL }}">
{{ .Title }}
</a>
</h1>
</div>
<div class="post-meta">
<div class="date">