From e9ec93a471d9a753db01b682e75c52b32adf16f2 Mon Sep 17 00:00:00 2001 From: Christoph Cullmann Date: Thu, 18 Feb 2021 21:44:01 +0100 Subject: use LoveIt theme, self hosted --- .../LoveIt/layouts/partials/plugin/analytics.html | 22 +++ .../layouts/partials/plugin/compatibility.html | 22 +++ themes/LoveIt/layouts/partials/plugin/icon.html | 13 ++ themes/LoveIt/layouts/partials/plugin/image.html | 38 ++++ themes/LoveIt/layouts/partials/plugin/link.html | 9 + themes/LoveIt/layouts/partials/plugin/script.html | 25 +++ themes/LoveIt/layouts/partials/plugin/share.html | 199 +++++++++++++++++++++ themes/LoveIt/layouts/partials/plugin/social.html | 11 ++ themes/LoveIt/layouts/partials/plugin/style.html | 31 ++++ 9 files changed, 370 insertions(+) create mode 100644 themes/LoveIt/layouts/partials/plugin/analytics.html create mode 100644 themes/LoveIt/layouts/partials/plugin/compatibility.html create mode 100644 themes/LoveIt/layouts/partials/plugin/icon.html create mode 100644 themes/LoveIt/layouts/partials/plugin/image.html create mode 100644 themes/LoveIt/layouts/partials/plugin/link.html create mode 100644 themes/LoveIt/layouts/partials/plugin/script.html create mode 100644 themes/LoveIt/layouts/partials/plugin/share.html create mode 100644 themes/LoveIt/layouts/partials/plugin/social.html create mode 100644 themes/LoveIt/layouts/partials/plugin/style.html (limited to 'themes/LoveIt/layouts/partials/plugin') diff --git a/themes/LoveIt/layouts/partials/plugin/analytics.html b/themes/LoveIt/layouts/partials/plugin/analytics.html new file mode 100644 index 0000000..c4c21fa --- /dev/null +++ b/themes/LoveIt/layouts/partials/plugin/analytics.html @@ -0,0 +1,22 @@ +{{- $analytics := .Scratch.Get "analytics" | default dict -}} + +{{- if $analytics.enable -}} + {{- /* Google Analytics */ -}} + {{- with $analytics.google.id -}} + + {{- printf "https://www.googletagmanager.com/gtag/js?id=%v" . | dict "Async" true "Source" | partial "plugin/script.html" -}} + {{- end -}} + + {{- /* Fathom Analytics */ -}} + {{- with $analytics.fathom.id -}} + + {{- dict "Source" ($analytics.fathom.server | default "cdn.usefathom.com" | printf "https://%v/tracker.js") "Async" true "Attr" "id=fathom-script" | partial "plugin/script.html" -}} + {{- end -}} +{{- end -}} diff --git a/themes/LoveIt/layouts/partials/plugin/compatibility.html b/themes/LoveIt/layouts/partials/plugin/compatibility.html new file mode 100644 index 0000000..b460f18 --- /dev/null +++ b/themes/LoveIt/layouts/partials/plugin/compatibility.html @@ -0,0 +1,22 @@ +{{- $compatibility := .Site.Params.compatibility | default dict -}} +{{- $cdn := .Scratch.Get "cdn" | default dict -}} +{{- $fingerprint := .Scratch.Get "fingerprint" -}} + +{{- /* Polyfill.io */ -}} +{{- if $compatibility.polyfill -}} + {{- $features := slice -}} + {{- range resources.Get "data/polyfill.yml" | transform.Unmarshal -}} + {{- range . -}} + {{- $features = $features | append . -}} + {{- end -}} + {{- end -}} + {{- with $features | uniq -}} + {{- delimit . "%2C" | printf "https://polyfill.io/v3/polyfill.min.js?features=%v" | dict "Source" | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}} + {{- end -}} +{{- end -}} + +{{- /* object-fit-images */ -}} +{{- if $compatibility.objectFit -}} + {{- $source := $cdn.objectFitImagesJS | default "lib/object-fit-images/ofi.min.js" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} +{{- end -}} diff --git a/themes/LoveIt/layouts/partials/plugin/icon.html b/themes/LoveIt/layouts/partials/plugin/icon.html new file mode 100644 index 0000000..5bc2a11 --- /dev/null +++ b/themes/LoveIt/layouts/partials/plugin/icon.html @@ -0,0 +1,13 @@ +{{- with .Class -}} + +{{- else -}} + {{- $src := .Src -}} + {{- with .Simpleicons -}} + {{- $prefix := $.Prefix | default "lib/simple-icons/icons" | strings.TrimSuffix "/" -}} + {{- $src = printf "%v/%v.svg" $prefix . -}} + {{- end -}} + {{- if (urls.Parse $src).Host | not -}} + {{- $src = (resources.Get $src | minify).RelPermalink -}} + {{- end -}} + +{{- end -}} diff --git a/themes/LoveIt/layouts/partials/plugin/image.html b/themes/LoveIt/layouts/partials/plugin/image.html new file mode 100644 index 0000000..84a61b3 --- /dev/null +++ b/themes/LoveIt/layouts/partials/plugin/image.html @@ -0,0 +1,38 @@ +{{- /* lazysizes and lightgallery.js */ -}} +{{- $src := .Src -}} +{{- with dict "Path" .Src "Resources" .Resources | partial "function/resource.html" -}} + {{- $src = .RelPermalink -}} +{{- end -}} + +{{- $small := .SrcSmall | default $src -}} +{{- with dict "Path" .SrcSmall "Resources" .Resources | partial "function/resource.html" -}} + {{- $small = .RelPermalink -}} +{{- end -}} + +{{- $large := .SrcLarge | default $src -}} +{{- with dict "Path" .SrcLarge "Resources" .Resources | partial "function/resource.html" -}} + {{- $large = .RelPermalink -}} +{{- end -}} + +{{- $alt := .Alt | default $src -}} +{{- $loading := resources.Get "svg/loading.svg" | minify -}} +{{- if .Linked -}} + + {{ $alt }} + +{{- else -}} + {{ $alt }} +{{- end -}} diff --git a/themes/LoveIt/layouts/partials/plugin/link.html b/themes/LoveIt/layouts/partials/plugin/link.html new file mode 100644 index 0000000..ceaefc6 --- /dev/null +++ b/themes/LoveIt/layouts/partials/plugin/link.html @@ -0,0 +1,9 @@ +{{- $rel := "" -}} + + {{- with .Icon -}} + {{- partial "plugin/icon.html" . -}} + {{- end -}} + {{- with .Content -}} + {{- . | safeHTML -}} + {{- end -}} + \ No newline at end of file diff --git a/themes/LoveIt/layouts/partials/plugin/script.html b/themes/LoveIt/layouts/partials/plugin/script.html new file mode 100644 index 0000000..e12e74e --- /dev/null +++ b/themes/LoveIt/layouts/partials/plugin/script.html @@ -0,0 +1,25 @@ +{{- if .Content -}} + +{{- else if strings.HasPrefix .Source " +{{- end -}} diff --git a/themes/LoveIt/layouts/partials/plugin/share.html b/themes/LoveIt/layouts/partials/plugin/share.html new file mode 100644 index 0000000..941647c --- /dev/null +++ b/themes/LoveIt/layouts/partials/plugin/share.html @@ -0,0 +1,199 @@ +{{- $share := (.Scratch.Get "params").share | default dict -}} + +{{- if $share.enable -}} + {{- /* 001: Twitter */ -}} + {{- if $share.Twitter -}} + + {{- dict "Class" "fab fa-twitter fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} + + {{- /* 002: Facebook */ -}} + {{- if $share.Facebook -}} + + {{- dict "Class" "fab fa-facebook-square fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} + + {{- /* 003: Linkedin */ -}} + {{- if $share.Linkedin -}} + + {{- dict "Class" "fab fa-linkedin fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} + + {{- /* 004: WhatsApp */ -}} + {{- if $share.Whatsapp -}} + + {{- dict "Class" "fab fa-whatsapp fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} + + {{- /* 005: Viber */ -}} + {{- if $share.Viber -}} + + {{- dict "Class" "fab fa-viber fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} + + {{- /* 006: Pinterest */ -}} + {{- if $share.Pinterest -}} + + {{- dict "Class" "fab fa-pinterest fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} + + {{- /* 007: Tumblr */ -}} + {{- if $share.Tumblr -}} + + {{- dict "Class" "fab fa-tumblr fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} + + {{- /* 008: Hacker News */ -}} + {{- if $share.Hackernews -}} + + {{- dict "Class" "fab fa-hacker-news fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} + + {{- /* 009: Reddit */ -}} + {{- if $share.Reddit -}} + + {{- dict "Class" "fab fa-reddit fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} + + {{- /* 010: VK */ -}} + {{- if $share.VK -}} + + {{- dict "Class" "fab fa-vk fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} + + {{- /* 011: Buffer */ -}} + {{- if $share.Buffer -}} + + {{- dict "Class" "fab fa-buffer fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} + + {{- /* 012: Xing */ -}} + {{- if $share.Xing -}} + + {{- dict "Class" "fab fa-xing fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} + + {{- /* 013: Line */ -}} + {{- if $share.Line -}} + + {{- dict "Simpleicons" "line" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}} + + {{- end -}} + + {{- /* 014: Instapaper */ -}} + {{- if $share.Instapaper -}} + + {{- dict "Simpleicons" "instapaper" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}} + + {{- end -}} + + {{- /* 015: Pocket */ -}} + {{- if $share.Pocket -}} + + {{- dict "Class" "fab fa-get-pocket fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} + + {{- /* 016: Digg */ -}} + {{- if $share.Digg -}} + + {{- dict "Class" "fab fa-digg fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} + + {{- /* 017: StumbleUpon */ -}} + {{- if $share.Stumbleupon -}} + + {{- dict "Class" "fab fa-stumbleupon fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} + + {{- /* 018: Flipboard */ -}} + {{- if $share.Flipboard -}} + + {{- dict "Class" "fab fa-flipboard fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} + + {{- /* 019: 微博 */ -}} + {{- if $share.Weibo -}} + + {{- dict "Class" "fab fa-weibo fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} + + {{- /* 020: 人人 */ -}} + {{- if $share.Renren -}} + + {{- dict "Class" "fab fa-renren fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} + + {{- /* 021: Myspace */ -}} + {{- if $share.Myspace -}} + + {{- dict "Simpleicons" "myspace" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}} + + {{- end -}} + + {{- /* 022: Blogger */ -}} + {{- if $share.Blogger -}} + + {{- dict "Class" "fab fa-blogger fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} + + {{- /* 023: 百度 */ -}} + {{- if $share.Baidu -}} + + {{- dict "Simpleicons" "baidu" "Prefix" (.Scratch.Get "cdn" | default dict).simpleIconsPrefix | partial "plugin/icon.html" -}} + + {{- end -}} + + {{- /* 024: OK.RU */ -}} + {{- if $share.Odnoklassniki -}} + + {{- dict "Class" "fab fa-odnoklassniki fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} + + {{- /* 025: Evernote */ -}} + {{- if $share.Evernote -}} + + {{- dict "Class" "fab fa-evernote fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} + + {{- /* 026: Skype */ -}} + {{- if $share.Skype -}} + + {{- dict "Class" "fab fa-skype fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} + + {{- /* 027: Trello */ -}} + {{- if $share.Trello -}} + + {{- dict "Class" "fab fa-trello fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} + + {{- /* 028: Mix */ -}} + {{- if $share.Mix -}} + + {{- dict "Class" "fab fa-mix fa-fw" | partial "plugin/icon.html" -}} + + {{- end -}} +{{- end -}} diff --git a/themes/LoveIt/layouts/partials/plugin/social.html b/themes/LoveIt/layouts/partials/plugin/social.html new file mode 100644 index 0000000..e6d2005 --- /dev/null +++ b/themes/LoveIt/layouts/partials/plugin/social.html @@ -0,0 +1,11 @@ +{{- $destination := "" -}} +{{- with .Url -}} + {{- $destination = . | relLangURL -}} +{{- else -}} + {{- $template := .Template | default "%v" -}} + {{- with .Prefix -}} + {{- $template = . | strings.TrimSuffix "/" | printf "%v/%%v" -}} + {{- end -}} + {{- $destination = printf (string $template) .Id -}} +{{- end -}} +{{- dict "Destination" $destination "Rel" "me" | merge . | partial "plugin/link.html" -}} diff --git a/themes/LoveIt/layouts/partials/plugin/style.html b/themes/LoveIt/layouts/partials/plugin/style.html new file mode 100644 index 0000000..9c9c989 --- /dev/null +++ b/themes/LoveIt/layouts/partials/plugin/style.html @@ -0,0 +1,31 @@ +{{- if strings.HasPrefix .Source " +{{- end -}} -- cgit v1.2.3