From 63db956f605aa9d2e04c748da034c84e5c08081b Mon Sep 17 00:00:00 2001 From: kogeletey <kg@re128.org> Date: Sat, 16 Jul 2022 13:05:43 +0300 Subject: [PATCH] [feature]: create anchors for quick page navigation templates: implementation anchors links sass: now everything works whe you hover over the title content/reference: special parameter for enable pages on section anchors root: config adding anchor slugify setting. --- config.toml | 3 ++- content/reference/_index.md | 1 + sass/_article.scss | 7 +++++-- templates/anchor-link.html | 1 + 4 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 templates/anchor-link.html diff --git a/config.toml b/config.toml index 2782fd9..17d1c96 100755 --- a/config.toml +++ b/config.toml @@ -22,7 +22,8 @@ taxonomies = [ ] [slugify] -paths = "on" +paths = "safe" +anchors = "on" [markdown] highlight_code = true diff --git a/content/reference/_index.md b/content/reference/_index.md index d54c395..f274e3c 100644 --- a/content/reference/_index.md +++ b/content/reference/_index.md @@ -3,4 +3,5 @@ title = "Reference" sort_by = "weight" weight = 3 +insert_anchor_links = "left" +++ diff --git a/sass/_article.scss b/sass/_article.scss index 1ffa32d..5ea0ad5 100644 --- a/sass/_article.scss +++ b/sass/_article.scss @@ -27,11 +27,13 @@ article { h2 { margin-top: 1.25rem; margin-bottom: 1.25rem; - &:hover::before { + &:hover{ + a.anchors::before { content: '#'; margin-right: 0.25rem; color: var(--green); - } + } + } } h3, h4, @@ -176,6 +178,7 @@ nav.navigation { } } + @media (max-width: 1000px) { article { padding-top: 2.5rem; diff --git a/templates/anchor-link.html b/templates/anchor-link.html new file mode 100644 index 0000000..22e1e21 --- /dev/null +++ b/templates/anchor-link.html @@ -0,0 +1 @@ +<a class = "anchors" href="#{{ id }}"></a> -- GitLab