Welcome to mirror list, hosted at ThFree Co, Russian Federation.

render-heading.html « _markup « _default « layouts - gitlab.com/rmaguiar/hugo-theme-color-your-world.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2e2d6510947de83e3f0746d23eed454924d571ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!--
  Anchor links for heading
  Level 2 to 6
  
  TODO
  It looks weird when the heading is also a link,
  but then that's also true for links in ToCs
  Would like to test a few more things
-->

{{ $anchoredLinkLevels := seq 2 6 }}

{{ if in $anchoredLinkLevels .Level }}
  <h{{ .Level }} id="{{ .Anchor | safeURL }}">{{ .Text | safeHTML }} {{ printf "<a class=\"anchor\" href=\"#%s\" title='%s \"%s\".'><svg aria-hidden=\"true\"><use xlink:href=\"#hashtag\"/></svg></a>" (.Anchor | safeURL) (T "anchorFor") (.Text | plainify | safeHTML) | safeHTML }}</h{{ .Level }}> 
{{ else }}
  <h{{ .Level }} id="{{ .Anchor | safeURL }}">{{ .Text | safeHTML }}</h{{ .Level }}> 
{{ end }}