diff options
Diffstat (limited to 'layouts/partials')
| -rw-r--r-- | layouts/partials/hypothesis.html | 3 | ||||
| -rw-r--r-- | layouts/partials/sidebar-toc.html | 10 | ||||
| -rw-r--r-- | layouts/partials/sidebar.html | 8 |
3 files changed, 16 insertions, 5 deletions
diff --git a/layouts/partials/hypothesis.html b/layouts/partials/hypothesis.html new file mode 100644 index 0000000..1417ea3 --- /dev/null +++ b/layouts/partials/hypothesis.html @@ -0,0 +1,3 @@ +<span class="hypothesis-container"> + <a class="sidebar-nav-item" id="hypothesis-link" href="#">{{ i18n "annotate" }}</a> +</span> diff --git a/layouts/partials/sidebar-toc.html b/layouts/partials/sidebar-toc.html index 9361aab..a6ac8d3 100644 --- a/layouts/partials/sidebar-toc.html +++ b/layouts/partials/sidebar-toc.html @@ -9,10 +9,20 @@ {{ $toc := .Page.TableOfContents }} {{ $home := printf `<a class="sidebar-nav-item" href="%s">%s</a>` site.Home.RelPermalink (i18n "home") | safeHTML }} + {{ $annotation := "" }} + + {{ if ne .Params.annotations false }} + {{ $annotation = (partial "hypothesis.html" .) }} + {{ end }} {{ $toc = $toc | replaceRE `id="TableOfContents"` `class="sidebar-nav"` | safeHTML }} {{ $toc = $toc | replaceRE "(<[/]?ul>|<[/]?ol>|<[/]?li>)" "" | safeHTML }} {{ $toc = $toc | replaceRE `<a href="(.*)">(.*)</a>` `<a class="sidebar-nav-item sidebar-nav-item-toc" href="$1">$2</a>` | safeHTML }} + + {{ if ne .Params.annotations false }} + {{ $toc = $toc | replaceRE `<nav class="sidebar-nav">` (printf `<nav class="sidebar-nav">%s` $annotation) | safeHTML }} + {{ end }} + {{ $toc = $toc | replaceRE `<nav class="sidebar-nav">` (printf `<nav class="sidebar-nav">%s` $home) | safeHTML }} {{ $toc }} diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index 7df1a2a..59d2360 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -22,11 +22,9 @@ </a> {{- end }} - <span class="hypothesis-container"> - <a class="sidebar-nav-item" id="hypothesis-link" href="#"> - {{ i18n "annotate" }} - </a> - </span> + {{- if ne .Params.annotations false }} + {{ partial "hypothesis.html" . }} + {{- end }} {{- with site.Menus.feeds }} <div class="sidebar-nav-item"> |
