Skip to content

Commit

Permalink
Create table of contents shortcode for Freenet theme.
Browse files Browse the repository at this point in the history
  • Loading branch information
sanity committed Jun 25, 2024
1 parent c74ad22 commit 1324c9e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions themes/freenet/layouts/shortcodes/toc.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{ $headings := .Page.Content | markdownify | plainify | findRE "(?m)^# (.+)$" }}
<ul>
{{ range $headings }}
{{ $heading := index . 1 }}
{{ if eq $heading "Why was Freenet rearchitected and rebranded?" }}
<li><a href="#faq-5">{{ $heading }}</a></li>
{{ else }}
<li><a href="#{{ $heading | urlize }}">{{ $heading }}</a></li>
{{ end }}
{{ end }}
</ul>

0 comments on commit 1324c9e

Please sign in to comment.