From 261956c1457a273a6a0d6d87cb12b268e7d358ff Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sun, 21 Feb 2021 13:24:55 +0100 Subject: [PATCH] fix: use custom render hook templates --- layouts/_default/_markup/render-heading.html | 18 ++++++++++++++++++ layouts/_default/_markup/render-image.html | 1 + layouts/_default/_markup/render-link.html | 2 ++ layouts/partials/content.html | 9 +-------- layouts/shortcodes/img.html | 2 +- src/sass/_base.scss | 14 ++++++++++++++ 6 files changed, 37 insertions(+), 9 deletions(-) create mode 100644 layouts/_default/_markup/render-heading.html create mode 100644 layouts/_default/_markup/render-image.html create mode 100644 layouts/_default/_markup/render-link.html diff --git a/layouts/_default/_markup/render-heading.html b/layouts/_default/_markup/render-heading.html new file mode 100644 index 0000000..7351dcd --- /dev/null +++ b/layouts/_default/_markup/render-heading.html @@ -0,0 +1,18 @@ +{{ $showAnchor := (and (default true .Page.Params.GeekblogAnchor) (default true .Page.Site.Params.GeekblogAnchor)) }} + +{{ if $showAnchor }} +
+ + {{ .Text | safeHTML }} + + + + +
+{{ else }} +
+ + {{ .Text | safeHTML }} + +
+{{ end }} diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html new file mode 100644 index 0000000..8a4d187 --- /dev/null +++ b/layouts/_default/_markup/render-image.html @@ -0,0 +1 @@ +{{ .Text }} \ No newline at end of file diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html new file mode 100644 index 0000000..6234c49 --- /dev/null +++ b/layouts/_default/_markup/render-link.html @@ -0,0 +1,2 @@ +{{ $raw := or (hasPrefix .Text "{{ .Text | safeHTML }} diff --git a/layouts/partials/content.html b/layouts/partials/content.html index d33bc1f..c35e992 100644 --- a/layouts/partials/content.html +++ b/layouts/partials/content.html @@ -1,8 +1 @@ -{{ $showAnchor := (and (default true .Page.Params.GeekblogAnchor) (default true .Site.Params.GeekblogAnchor)) }} - -{{ $.Scratch.Set "content" (.Content | replaceRE `` `` | safeHTML) }} -{{ if $showAnchor }} - {{ $.Scratch.Set "content" ($.Scratch.Get "content" | replaceRE "(]*>)(.*?)()" (printf `
%s%s%s
` `${1}` `${3}` (absURL (printf "%s#%s" .Permalink `${2}`)) `${3}` `${2}` `${4}`) | safeHTML) }} -{{ end }} - -{{ $.Scratch.Get "content" }} +{{ .Content | replaceRE `` `` | safeHTML }} diff --git a/layouts/shortcodes/img.html b/layouts/shortcodes/img.html index 3c12733..b6b0a12 100644 --- a/layouts/shortcodes/img.html +++ b/layouts/shortcodes/img.html @@ -14,7 +14,7 @@