summaryrefslogtreecommitdiff
path: root/layouts/_default
diff options
context:
space:
mode:
authorSangeeth Sudheer <git@sangeeth.dev>2024-11-17 16:24:22 +0530
committerSangeeth Sudheer <git@sangeeth.dev>2024-11-17 16:27:18 +0530
commit047cecf5e03e27c57026b4c7a8d50a5e0bfc6c3c (patch)
tree3cb37c0694ef5abeab09062a222498385fc9a835 /layouts/_default
parentf025f972e0b1ffb8df288be632bb3c34a58b66e8 (diff)
Add article heading anchors
Adds heading anchors (#) that appear when user hovers over headings in articles. Clicking the anchor will scroll viewport until heading is aligned to top and update the address bar with the hash. This makes it easy to copy URLs that link to a specific heading in the article.
Diffstat (limited to 'layouts/_default')
-rw-r--r--layouts/_default/_markup/render-heading.html4
1 files changed, 4 insertions, 0 deletions
diff --git a/layouts/_default/_markup/render-heading.html b/layouts/_default/_markup/render-heading.html
new file mode 100644
index 0000000..44430d6
--- /dev/null
+++ b/layouts/_default/_markup/render-heading.html
@@ -0,0 +1,4 @@
+<h{{ .Level }} class="heading" id="{{ .Anchor }}">
+ {{ .Text }}
+ <a href="#{{ .Anchor }}">#</a>
+</h{{ .Level }}>