diff options
Diffstat (limited to 'layouts')
| -rw-r--r-- | layouts/_default/single.html | 4 | ||||
| -rw-r--r-- | layouts/partials/anchored_headings.html | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index d4476ed..e46d05f 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -41,7 +41,9 @@ </details> </div> {{- end }} - <div class="post-content">{{ .Content }}</div> + <div class="post-content"> + {{- partial "anchored_headings.html" .Content -}} + </div> <footer class="post-footer"> {{- if .Params.tags }} <ul class="post-tags"> diff --git a/layouts/partials/anchored_headings.html b/layouts/partials/anchored_headings.html index 62a5084..27184fe 100644 --- a/layouts/partials/anchored_headings.html +++ b/layouts/partials/anchored_headings.html @@ -1,2 +1,2 @@ <!-- formats .Content headings by adding an anchor --> -{{ . | replaceRE "(<h[2-3] id=\"([^\"]+)\".+)(</h[2-9]+>)" "${1}<a class=\"anchor\" href=\"#${2}\">#</a>${3}" | safeHTML }} +{{ . | replaceRE "(<h[1-6] id=\"([^\"]+)\".+)(</h[1-6]+>)" "${1}<a hidden class=\"anchor\" aria-hidden=\"true\" href=\"#${2}\">#</a>${3}" | safeHTML }} |
