commit 8cc1dc53d714778e6aa4a5cb7dfb02269fd53c69
parent 79724ccf0844a2baed7c2fa3cd39d5d1e32d7d8c
Author: FIGBERT <figbert@figbert.com>
Date: Fri, 22 Jan 2021 12:26:29 -0800
Replace header :before with Zola anchor links
Diffstat:
5 files changed, 24 insertions(+), 63 deletions(-)
diff --git a/content/_index.md b/content/_index.md
@@ -1,5 +1,6 @@
+++
title = "Home"
+insert_anchor_links = "left"
+++
## Hello World
diff --git a/content/posts/_index.md b/content/posts/_index.md
@@ -4,5 +4,6 @@ description = ""
sort_by = "date"
template = "page-list.html"
page_template = "article.html"
+insert_anchor_links = "left"
+++
diff --git a/content/projects/_index.md b/content/projects/_index.md
@@ -4,5 +4,6 @@ description = ""
sort_by = "weight"
template = "page-list.html"
page_template = "article.html"
+insert_anchor_links = "left"
+++
diff --git a/sass/headers.sass b/sass/headers.sass
@@ -1,34 +1,6 @@
@import variables.sass
-h1
- &::before
- content: "#"
- padding-right: 0.5rem
- color: $secondary-color
- a
- color: inherit
- &::before
- content: ""
- &::after
- content: ""
-
-h2
- &::before
- content: "##"
- padding-right: 0.5rem
- color: $secondary-color
- a
- color: inherit
- &::before
- content: ""
- &::after
- content: ""
-
-h3
- &::before
- content: "###"
- padding-right: 0.5rem
- color: $secondary-color
+h1, h2, h3, h4, h5, h6
a
color: inherit
&::before
@@ -36,39 +8,10 @@ h3
&::after
content: ""
-h4
+.zola-anchor
+ color: $secondary-color
&::before
- content: "####"
- padding-right: 0.5rem
- color: $secondary-color
- a
- color: inherit
- &::before
- content: ""
- &::after
- content: ""
-
-h5
- &::before
- content: "#####"
- padding-right: 0.5rem
- color: $secondary-color
- a
- color: inherit
- &::before
- content: ""
- &::after
- content: ""
-
-h6
- &::before
- content: "######"
- padding-right: 0.5rem
- color: $secondary-color
- a
- color: inherit
- &::before
- content: ""
- &::after
- content: ""
+ content: ""
+ &::after
+ content: ""
diff --git a/templates/anchor-link.html b/templates/anchor-link.html
@@ -0,0 +1,15 @@
+<a class="zola-anchor" href="#{{ id }}" aria-label="Anchor link for: {{ id }}">
+ {%- if level == 1 -%}
+ #
+ {%- elif level == 2 -%}
+ ##
+ {%- elif level == 3 -%}
+ ###
+ {%- elif level == 4 -%}
+ ####
+ {%- elif level == 5 -%}
+ #####
+ {%- elif level == 6 -%}
+ ######
+ {% endif %}
+</a>