diff --git a/CHANGELOG.md b/CHANGELOG.md index b43abecf45..9641dd3ee6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,11 @@ For the full list of changes, see the [0.9.0] release notes. [render-heading.html](https://gohugo.io/templates/render-hooks/) hook. This is _potentially_ a breaking change for projects that override the hook. + The default heading-link symbol is `#`, but it can be customized via the + `.td-header-link` class. Projects can also _reuse_ (in their own heading + render hooks) or _override_ the heading anchor-link template + `docsy/header-link.html` under `layouts`. + - The footer layout has been factored into parts: left, right, and center, with copyright a subpart of center. Each part has its own style tag, for example: `td-footer__left`. Note that the style `td-footer__copyright-etc` has been diff --git a/assets/scss/_content.scss b/assets/scss/_content.scss index 4a75992d5f..320f86ec2f 100644 --- a/assets/scss/_content.scss +++ b/assets/scss/_content.scss @@ -94,3 +94,27 @@ font-size: 3rem; } } + +.td-header-link { + &::before { + content: '#'; + } + + font-size: 90%; + padding-left: 0.25em; + text-decoration: none; + visibility: hidden; + + // Always visible on touch devices and small screens + @media (hover: none) and (pointer: coarse), + (max-width: map-get($grid-breakpoints, sm)) { + visibility: visible; + } + +} + +@for $i from 1 through 6 { + h#{$i}:hover>.td-header-link { + visibility: visible; + } +} diff --git a/layouts/_default/_markup/render-heading.html b/layouts/_default/_markup/render-heading.html index 1ff23d72b1..ab57be20b6 100644 --- a/layouts/_default/_markup/render-heading.html +++ b/layouts/_default/_markup/render-heading.html @@ -1,3 +1,8 @@ -{{ .Text | safeHTML }} - - \ No newline at end of file + + {{- .Text | safeHTML -}} + {{ template "docsy/header-link.html" . -}} + + +{{- define "docsy/header-link.html" -}} + +{{- end -}}