Skip to content

Commit

Permalink
remove left anchor option and adjust spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
xoxys committed Sep 7, 2020
1 parent 74b88ed commit e1ef957
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 14 deletions.
2 changes: 0 additions & 2 deletions exampleSite/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,5 @@ params:
geekblogToC: 3
geekblogAuthor: john-doe

geekblogAnchorLeft: true

geekblogLegalNotice: https://thegeeklab.de/legal-notice/#contact-information
geekblogPrivacyPolicy: https://thegeeklab.de/legal-notice/#privacy-policy
6 changes: 0 additions & 6 deletions exampleSite/content/posts/how-to-use.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@ enableGitInfo = true
# (Optional, default true) Add an anchor link to headlines.
geekblogAnchor = true

# (Optional, default false) Move anchor link to the left side of headlines.
geekblogAnchorLeft = false

# (Optional, default true) Copy anchor url to clipboard on click.
geekblogAnchorCopy = true

Expand Down Expand Up @@ -227,9 +224,6 @@ params:
# (Optional, default true) Add an anchor link to headlines.
geekblogAnchor: true

# (Optional, default false) Move anchor link to the left side of headlines.
geekblogAnchorLeft: false

# (Optional, default true) Copy anchor url to clipboard on click.
geekblogAnchorCopy: true

Expand Down
5 changes: 1 addition & 4 deletions layouts/partials/content.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{{ $showAnchor := (and (default true .Page.Params.GeekblogAnchor) (default true .Site.Params.GeekblogAnchor)) }}
{{ $anchorLeft := (default false .Site.Params.GeekblogAnchorLeft) }}

{{ $.Scratch.Set "content" (.Content | replaceRE `<nav id="TableOfContents">\s*<ul>\s*<li>\s*<ul>` `<nav id="TableOfContents"><ul>` | replaceRE `</ul>\s*</li>\s*</ul>\s*</nav>` `</ul></nav>` | safeHTML) }}
{{ if and $showAnchor $anchorLeft }}
{{ $.Scratch.Set "content" ($.Scratch.Get "content" | replaceRE "(<h[2-9] id=\"([^\"]+)\"[^>]*>)(.*?)(</h[2-9]+>)" (printf `<div class="gblog-post__anchorwrap">%s<a data-clipboard-text="%s" class="gblog-post__anchor gblog-post__anchor--left clip" aria-label="Anchor %s" href="#%s"><svg class="icon link"><use xlink:href="#link"></use></svg></a>%s%s</div>` `${1}` (absURL (printf "%s#%s" .Permalink `${2}`)) `${3}` `${2}` `${3}` `${4}`) | safeHTML) }}
{{ else if and $showAnchor (not $anchorLeft) }}
{{ if $showAnchor }}
{{ $.Scratch.Set "content" ($.Scratch.Get "content" | replaceRE "(<h[2-9] id=\"([^\"]+)\"[^>]*>)(.*?)(</h[2-9]+>)" (printf `<div class="gblog-post__anchorwrap">%s%s<a data-clipboard-text="%s" class="gblog-post__anchor gblog-post__anchor--right clip" aria-label="Anchor %s" href="#%s"><svg class="icon link"><use xlink:href="#link"></use></svg></a>%s</div>` `${1}` `${3}` (absURL (printf "%s#%s" .Permalink `${2}`)) `${3}` `${2}` `${4}`) | safeHTML) }}
{{ end }}

Expand Down
5 changes: 3 additions & 2 deletions src/sass/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ img {
width: 100%;
max-width: $container-max-width;
margin: 0 auto;
padding: $padding-16 $padding-16 * 1.5;
padding: $padding-16;
}

.icon {
Expand Down Expand Up @@ -134,7 +134,8 @@ img {
color: $gray-200;

.container {
padding: $padding-8 $padding-16;
padding-top: $padding-8;
padding-bottom: $padding-8;
}

li {
Expand Down

0 comments on commit e1ef957

Please sign in to comment.