mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2024-11-23 10:21:46 +01:00
feat: add article.headingAnchor
parameter and use CSS pseudo-element to display #
symbol of heading anchor (#1016)
* feat: add `article.headingAnchor` parameter * feat: use CSS pseudo-element to display `#` symbol of heading anchor This prevents RSS feed readers and screen readers from seeing an extra `#`. * Deactivate `article.headingAnchor` by default
This commit is contained in:
parent
130e2f6607
commit
f3783856ad
3 changed files with 8 additions and 1 deletions
|
@ -232,6 +232,10 @@
|
||||||
width: var(--card-padding);
|
width: var(--card-padding);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: var(--accent-color);
|
color: var(--accent-color);
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
content: "#";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover,
|
&:hover,
|
||||||
|
|
|
@ -28,6 +28,7 @@ params:
|
||||||
src: img/avatar.png
|
src: img/avatar.png
|
||||||
|
|
||||||
article:
|
article:
|
||||||
|
headingAnchor: false
|
||||||
math: false
|
math: false
|
||||||
toc: true
|
toc: true
|
||||||
readingTime: true
|
readingTime: true
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<h{{ .Level }} id="{{ .Anchor }}">
|
<h{{ .Level }} id="{{ .Anchor }}">
|
||||||
<a href="#{{ .Anchor }}" class="header-anchor">#</a>
|
{{- if site.Params.Article.HeadingAnchor -}}
|
||||||
|
<a href="#{{ .Anchor }}" class="header-anchor"></a>
|
||||||
|
{{- end -}}
|
||||||
{{ .Text | safeHTML }}
|
{{ .Text | safeHTML }}
|
||||||
</h{{ .Level }}>
|
</h{{ .Level }}>
|
Loading…
Reference in a new issue