From 9f6a5b44f84c0157862ef5f46aebe4bc390cfcce Mon Sep 17 00:00:00 2001 From: Andrew Stryker Date: Wed, 26 Feb 2025 20:10:48 -0800 Subject: [PATCH] Add basic partials --- layouts/partials/extend_head.html | 27 +++++++++++++++++++++++++++ layouts/partials/math.html | 7 +++++++ layouts/partials/mermaid.html | 5 +++++ layouts/partials/social-share.html | 16 ++++++++++++++++ 4 files changed, 55 insertions(+) create mode 100644 layouts/partials/extend_head.html create mode 100644 layouts/partials/math.html create mode 100644 layouts/partials/mermaid.html create mode 100644 layouts/partials/social-share.html diff --git a/layouts/partials/extend_head.html b/layouts/partials/extend_head.html new file mode 100644 index 0000000..498f5ca --- /dev/null +++ b/layouts/partials/extend_head.html @@ -0,0 +1,27 @@ + +{{ $threshold := .Site.Params.tocWordCountThreshold | default 300 }} +{{ $showToc := false }} +{{ if isset .Params "toc" }} + {{ $showToc = .Params.xparams.toc }} +{{ else }} + {{ $wordCount := countwords .Content }} + {{ $showToc = gt $wordCount $threshold }} +{{ end }} + +{{ if $showToc }} + +{{ end }} + + +{{ if .Params.xparams.math }} + {{ partial "math.html" . }} +{{ end }} + + +{{ if .Params.xparams.mermaid }} + {{ partial "mermaid.html" . }} +{{ end }} + +{{ partial "social-share.html" . }} diff --git a/layouts/partials/math.html b/layouts/partials/math.html new file mode 100644 index 0000000..182f4c9 --- /dev/null +++ b/layouts/partials/math.html @@ -0,0 +1,7 @@ + + + + + + diff --git a/layouts/partials/mermaid.html b/layouts/partials/mermaid.html new file mode 100644 index 0000000..3146eb7 --- /dev/null +++ b/layouts/partials/mermaid.html @@ -0,0 +1,5 @@ + + + diff --git a/layouts/partials/social-share.html b/layouts/partials/social-share.html new file mode 100644 index 0000000..0beaaf9 --- /dev/null +++ b/layouts/partials/social-share.html @@ -0,0 +1,16 @@ +
+ {{/* Mastodon Sharing: Only render if enabled in the post’s YAML */}} + {{ if .Params.social.mastodon }} + {{ $mastodon := .Site.Params.social.mastodon_instance }} + + Share on Mastodon + + {{ end }} + + {{/* LinkedIn Sharing: Only render if enabled in the post’s YAML */}} + {{ if .Params.social.linkedin }} + + Share on LinkedIn + + {{ end }} +