From c4422703620c3b4260c7c14b941575bc5fbd2026 Mon Sep 17 00:00:00 2001 From: Daniel Kraus Date: Mon, 5 Aug 2024 19:55:27 +0200 Subject: [PATCH] Initial partials and shortcodes. --- layouts/partials/analytics.html | 16 +++++++++++ layouts/partials/posts_single_info.html | 22 ++++++++++++++ layouts/partials/social-share.html | 37 ++++++++++++++++++++++++ layouts/shortcodes/figure.html | 38 +++++++++++++++++++++++++ 4 files changed, 113 insertions(+) create mode 100644 layouts/partials/analytics.html create mode 100644 layouts/partials/posts_single_info.html create mode 100644 layouts/partials/social-share.html create mode 100644 layouts/shortcodes/figure.html diff --git a/layouts/partials/analytics.html b/layouts/partials/analytics.html new file mode 100644 index 0000000..c55406a --- /dev/null +++ b/layouts/partials/analytics.html @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/layouts/partials/posts_single_info.html b/layouts/partials/posts_single_info.html new file mode 100644 index 0000000..472f037 --- /dev/null +++ b/layouts/partials/posts_single_info.html @@ -0,0 +1,22 @@ +{{- with .Params.description }}

{{.}}

{{- end }} +{{- if and .Params.author .Params.authorLink}}{{ $relreflink := relref . .Params.authorLink }}

{{ partial "svg.html" (dict "context" . "name" "author") }}{{ .Params.author }}

+{{- else if .Params.author }}{{ $relreflink := relref . .Site.Params.author.about }}

{{ partial "svg.html" (dict "context" . "name" "author") }}{{ .Params.author }}

+{{- else }}{{ $relreflink := relref . .Site.Params.author.about }}

{{ partial "svg.html" (dict "context" . "name" "author") }}{{ .Site.Params.author.name }}

+{{- end }} +{{- with .Params.tags }} +

{{- partial "svg.html" (dict "context" . "name" "posts_single_tags") -}}{{- range . -}}{{.}}{{- end }}

+{{- end }} +{{- with .Params.categories }} +

{{- partial "svg.html" (dict "context" . "name" "posts_single_categories") -}}{{- range . -}}{{.}}{{- end }}

+{{- end }} +

{{- partial "svg.html" (dict "context" . "name" "posts_single_date") }}{{ dateFormat .Site.Params.dateformNumTime .Date.Local -}} + {{- if and (not (eq .Page.Params.ShowLastmod nil)) (.Page.Params.ShowLastmod) -}} + {{- if and .GitInfo .Site.Params.gitUrl -}} + [{{- partial "svg.html" (dict "context" . "name" "posts_single_git_commit") -}}{{ .GitInfo.AbbreviatedHash -}} @ {{ dateFormat .Site.Params.dateformNum .GitInfo.AuthorDate.Local -}}] + {{- else if not (eq .Lastmod .Date ) -}} +  [{{.Site.Params.initialPublish | default "Initial Published on : "}} {{ dateFormat .Site.Params.dateformNumTime .Lastmod.Local -}}] + {{- else -}} + {{ errorf "Lastmod is not found in Page Frontmatter or Lastmod is same as Date" }} + {{- end -}} + {{- end -}} +

\ No newline at end of file diff --git a/layouts/partials/social-share.html b/layouts/partials/social-share.html new file mode 100644 index 0000000..f0cc2dd --- /dev/null +++ b/layouts/partials/social-share.html @@ -0,0 +1,37 @@ + + + \ No newline at end of file diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html new file mode 100644 index 0000000..c7618b6 --- /dev/null +++ b/layouts/shortcodes/figure.html @@ -0,0 +1,38 @@ + + {{- if .Get "link" -}} + + {{- end -}} + + {{- $u := urls.Parse (.Get "src") -}} + {{- $src := $u.String -}} + {{- if not $u.IsAbs -}} + {{- with or (.Page.Resources.Get $u.Path) (resources.Get $u.Path) -}} + {{- $src = .RelPermalink -}} + {{- end -}} + {{- end -}} + + {{ with .Get + {{- if .Get "link" }}{{ end -}} + {{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}} +
+ {{ with (.Get "title") -}} +

{{ . }}

+ {{- end -}} + {{- if or (.Get "caption") (.Get "attr") -}}

+ {{- .Get "caption" | markdownify -}} + {{- with .Get "attrlink" }} + + {{- end -}} + {{- .Get "attr" | markdownify -}} + {{- if .Get "attrlink" }}{{ end }}

+ {{- end }} +
+ {{- end }} + \ No newline at end of file