From 29fcd231e3da9b33c237886f3c1bb30a557ad641 Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Sat, 19 Mar 2022 16:54:23 +0530 Subject: Initial Commit --- .../layouts/partials/anchored_headings.html | 2 + themes/PaperMod/layouts/partials/author.html | 9 + themes/PaperMod/layouts/partials/breadcrumbs.html | 19 + themes/PaperMod/layouts/partials/comments.html | 3 + themes/PaperMod/layouts/partials/cover.html | 40 ++ themes/PaperMod/layouts/partials/edit_post.html | 8 + .../PaperMod/layouts/partials/extend_footer.html | 3 + themes/PaperMod/layouts/partials/extend_head.html | 4 + themes/PaperMod/layouts/partials/footer.html | 135 ++++++ themes/PaperMod/layouts/partials/head.html | 163 +++++++ themes/PaperMod/layouts/partials/header.html | 121 +++++ themes/PaperMod/layouts/partials/home_info.html | 13 + .../PaperMod/layouts/partials/index_profile.html | 23 + .../PaperMod/layouts/partials/post_canonical.html | 9 + themes/PaperMod/layouts/partials/post_meta.html | 21 + .../PaperMod/layouts/partials/post_nav_links.html | 19 + themes/PaperMod/layouts/partials/share_icons.html | 71 +++ themes/PaperMod/layouts/partials/social_icons.html | 7 + themes/PaperMod/layouts/partials/svg.html | 518 +++++++++++++++++++++ .../layouts/partials/templates/opengraph.html | 52 +++ .../layouts/partials/templates/schema_json.html | 119 +++++ .../layouts/partials/templates/twitter_cards.html | 33 ++ themes/PaperMod/layouts/partials/toc.html | 97 ++++ .../layouts/partials/translation_list.html | 19 + 24 files changed, 1508 insertions(+) create mode 100644 themes/PaperMod/layouts/partials/anchored_headings.html create mode 100644 themes/PaperMod/layouts/partials/author.html create mode 100644 themes/PaperMod/layouts/partials/breadcrumbs.html create mode 100644 themes/PaperMod/layouts/partials/comments.html create mode 100644 themes/PaperMod/layouts/partials/cover.html create mode 100644 themes/PaperMod/layouts/partials/edit_post.html create mode 100644 themes/PaperMod/layouts/partials/extend_footer.html create mode 100644 themes/PaperMod/layouts/partials/extend_head.html create mode 100644 themes/PaperMod/layouts/partials/footer.html create mode 100644 themes/PaperMod/layouts/partials/head.html create mode 100644 themes/PaperMod/layouts/partials/header.html create mode 100644 themes/PaperMod/layouts/partials/home_info.html create mode 100644 themes/PaperMod/layouts/partials/index_profile.html create mode 100644 themes/PaperMod/layouts/partials/post_canonical.html create mode 100644 themes/PaperMod/layouts/partials/post_meta.html create mode 100644 themes/PaperMod/layouts/partials/post_nav_links.html create mode 100644 themes/PaperMod/layouts/partials/share_icons.html create mode 100644 themes/PaperMod/layouts/partials/social_icons.html create mode 100644 themes/PaperMod/layouts/partials/svg.html create mode 100644 themes/PaperMod/layouts/partials/templates/opengraph.html create mode 100644 themes/PaperMod/layouts/partials/templates/schema_json.html create mode 100644 themes/PaperMod/layouts/partials/templates/twitter_cards.html create mode 100644 themes/PaperMod/layouts/partials/toc.html create mode 100644 themes/PaperMod/layouts/partials/translation_list.html (limited to 'themes/PaperMod/layouts/partials') diff --git a/themes/PaperMod/layouts/partials/anchored_headings.html b/themes/PaperMod/layouts/partials/anchored_headings.html new file mode 100644 index 0000000..377af89 --- /dev/null +++ b/themes/PaperMod/layouts/partials/anchored_headings.html @@ -0,0 +1,2 @@ +{{- /* formats .Content headings by adding an anchor */ -}} +{{ . | replaceRE "()" "${1}${3}" | safeHTML }} diff --git a/themes/PaperMod/layouts/partials/author.html b/themes/PaperMod/layouts/partials/author.html new file mode 100644 index 0000000..4582b12 --- /dev/null +++ b/themes/PaperMod/layouts/partials/author.html @@ -0,0 +1,9 @@ +{{- if or .Params.author .Site.Params.author }} +{{- $author := (.Params.author | default .Site.Params.author) }} +{{- $author_type := (printf "%T" $author) }} +{{- if (or (eq $author_type "[]string") (eq $author_type "[]interface {}")) }} +{{- (delimit $author ", " ) }} +{{- else }} +{{- $author }} +{{- end }} +{{- end -}} diff --git a/themes/PaperMod/layouts/partials/breadcrumbs.html b/themes/PaperMod/layouts/partials/breadcrumbs.html new file mode 100644 index 0000000..742254a --- /dev/null +++ b/themes/PaperMod/layouts/partials/breadcrumbs.html @@ -0,0 +1,19 @@ +{{- if (.Param "ShowBreadCrumbs") -}} + +{{- end -}} diff --git a/themes/PaperMod/layouts/partials/comments.html b/themes/PaperMod/layouts/partials/comments.html new file mode 100644 index 0000000..918451a --- /dev/null +++ b/themes/PaperMod/layouts/partials/comments.html @@ -0,0 +1,3 @@ +{{- /* Comments area start */ -}} +{{- /* to add comments read => https://gohugo.io/content-management/comments/ */ -}} +{{- /* Comments area end */ -}} diff --git a/themes/PaperMod/layouts/partials/cover.html b/themes/PaperMod/layouts/partials/cover.html new file mode 100644 index 0000000..b4e7c78 --- /dev/null +++ b/themes/PaperMod/layouts/partials/cover.html @@ -0,0 +1,40 @@ +{{- with .cxt}} {{/* Apply proper context from dict */}} +{{- if (and .Params.cover.image (not $.isHidden)) }} +{{- $alt := (.Params.cover.alt | default .Params.cover.caption | plainify) }} +
+ {{- $responsiveImages := (.Params.cover.responsiveImages | default .Site.Params.cover.responsiveImages) | default true }} + {{- $addLink := (and .Site.Params.cover.linkFullImages (not $.IsHome)) }} + {{- $cover := (.Resources.ByType "image").GetMatch (printf "*%s*" (.Params.cover.image)) }} + {{- if $cover -}}{{/* i.e it is present in page bundle */}} + {{- if $addLink }}{{ end -}} + {{- $sizes := (slice "360" "480" "720" "1080" "1500") }} + {{- $processableFormats := (slice "jpg" "jpeg" "png" "tif" "bmp" "gif") -}} + {{- if hugo.IsExtended -}} + {{- $processableFormats = $processableFormats | append "webp" -}} + {{- end -}} + {{- $prod := (hugo.IsProduction | or (eq .Site.Params.env "production")) }} + {{- if (and (in $processableFormats $cover.MediaType.SubType) ($responsiveImages) (eq $prod true)) }} + {{ $alt }} + {{- else }}{{/* Unprocessable image or responsive images disabled */}} + {{ $alt }} + {{- end }} + {{- else }}{{/* For absolute urls and external links, no img processing here */}} + {{- if $addLink }}{{ end -}} + {{ $alt }} + {{- end }} + {{- if $addLink }}{{ end -}} + {{/* Display Caption */}} + {{- if not $.IsHome }} + {{ with .Params.cover.caption }}

{{ . | markdownify }}

{{- end }} + {{- end }} +
+{{- end }}{{/* End image */}} +{{- end -}}{{/* End context */ -}} diff --git a/themes/PaperMod/layouts/partials/edit_post.html b/themes/PaperMod/layouts/partials/edit_post.html new file mode 100644 index 0000000..1d90ebd --- /dev/null +++ b/themes/PaperMod/layouts/partials/edit_post.html @@ -0,0 +1,8 @@ +{{- if or .Params.editPost.URL .Site.Params.editPost.URL -}} +{{- $fileUrlPath := path.Join .File.Path }} + +{{- if or .Params.author $.Site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) .IsTranslated }} | {{- end -}} + + {{- .Params.editPost.Text | default (.Site.Params.editPost.Text | default (i18n "edit_post" | default "Edit")) -}} + +{{- end }} diff --git a/themes/PaperMod/layouts/partials/extend_footer.html b/themes/PaperMod/layouts/partials/extend_footer.html new file mode 100644 index 0000000..0519748 --- /dev/null +++ b/themes/PaperMod/layouts/partials/extend_footer.html @@ -0,0 +1,3 @@ +{{- /* Footer custom content area start */ -}} +{{- /* Insert any custom code web-analytics, resources, etc. here */ -}} +{{- /* Footer custom content area end */ -}} diff --git a/themes/PaperMod/layouts/partials/extend_head.html b/themes/PaperMod/layouts/partials/extend_head.html new file mode 100644 index 0000000..150cbef --- /dev/null +++ b/themes/PaperMod/layouts/partials/extend_head.html @@ -0,0 +1,4 @@ +{{- /* Head custom content area start */ -}} +{{- /* Insert any custom code (web-analytics, resources, etc.) - it will appear in the section of every page. */ -}} +{{- /* Can be overwritten by partial with the same name in the global layouts. */ -}} +{{- /* Head custom content area end */ -}} diff --git a/themes/PaperMod/layouts/partials/footer.html b/themes/PaperMod/layouts/partials/footer.html new file mode 100644 index 0000000..d6ee155 --- /dev/null +++ b/themes/PaperMod/layouts/partials/footer.html @@ -0,0 +1,135 @@ +{{- if not (.Param "hideFooter") }} + +{{- end }} + +{{- if (not .Site.Params.disableScrollToTop) }} + + + + + +{{- end }} + +{{- partial "extend_footer.html" . }} + + + +{{- if (not .Site.Params.disableScrollToTop) }} + +{{- end }} + +{{- if (not .Site.Params.disableThemeToggle) }} + +{{- end }} + +{{- if (and (eq .Kind "page") (ne .Layout "archives") (ne .Layout "search") (.Param "ShowCodeCopyButtons")) }} + +{{- end }} diff --git a/themes/PaperMod/layouts/partials/head.html b/themes/PaperMod/layouts/partials/head.html new file mode 100644 index 0000000..0d3fa72 --- /dev/null +++ b/themes/PaperMod/layouts/partials/head.html @@ -0,0 +1,163 @@ + + + +{{- if hugo.IsProduction | or (eq .Site.Params.env "production") }} + +{{- else }} + +{{- end }} + +{{- /* Title */}} +{{ if .IsHome }}{{ else }}{{ if .Title }}{{ .Title }} | {{ end }}{{ end }}{{ .Site.Title }} + +{{- /* Meta */}} +{{- if .IsHome }} +{{ with .Site.Params.keywords -}}{{ end }} +{{- else }} + +{{- end }} + + + +{{- if .Site.Params.analytics.google.SiteVerificationTag }} + +{{- end }} +{{- if .Site.Params.analytics.yandex.SiteVerificationTag }} + +{{- end }} +{{- if .Site.Params.analytics.bing.SiteVerificationTag }} + +{{- end }} + +{{- /* Styles */}} +{{- $theme_vars := (resources.Get "css/core/theme-vars.css") }} +{{- $reset := (resources.Get "css/core/reset.css") }} +{{- $media := (resources.Get "css/core/zmedia.css") }} +{{- $common := (resources.Match "css/common/*.css") | resources.Concat "assets/css/common.css" }} + +{{- /* include `an-old-hope` if hljs is on */}} +{{- $isHLJSdisabled := (.Site.Params.assets.disableHLJS | default false) }} +{{- $hljs := (cond ($isHLJSdisabled) (" " | resources.FromString "assets/css/hljs-blank.css") (resources.Get "css/hljs/an-old-hope.min.css")) }} + +{{- /* order is important */}} +{{- $core := (slice $theme_vars $reset $common $hljs $media) | resources.Concat "assets/css/core.css" }} +{{- $extended := (resources.Match "css/extended/*.css") | resources.Concat "assets/css/extended.css" }} + +{{- /* bundle all required css */}} +{{- /* Add extended css after theme style */ -}} +{{- $stylesheet := (slice $core $extended) | resources.Concat "assets/css/stylesheet.css" | minify }} + +{{- if not .Site.Params.assets.disableFingerprinting }} +{{- $stylesheet := $stylesheet | fingerprint }} + +{{- else }} + +{{- end }} + +{{- with .Site.Params.profileMode }} +{{- if and .enabled .imageUrl $.IsHome }} + +{{- end }} +{{- end }} + +{{- with .Site.Params.label.icon }} + +{{- end }} + +{{- /* Search */}} +{{- if (eq .Layout `search`) -}} + +{{- $fastsearch := resources.Get "js/fastsearch.js" | js.Build (dict "params" (dict "fuseOpts" .Site.Params.fuseOpts)) }} +{{- $fusejs := resources.Get "js/fuse.basic.min.js" }} +{{- if not .Site.Params.assets.disableFingerprinting }} +{{- $search := (slice $fusejs $fastsearch ) | resources.Concat "assets/js/search.js" | minify | fingerprint }} + +{{- else }} +{{- $search := (slice $fusejs $fastsearch ) | resources.Concat "assets/js/search.js" | minify }} + +{{- end }} +{{- end -}} + +{{- /* Highlight.js */}} +{{- $isHLJSdisabled := (.Site.Params.assets.disableHLJS | default .Params.disableHLJS ) }} +{{- if (and (eq .Kind "page") (ne .Layout "archives") (ne .Layout "search") (not $isHLJSdisabled)) }} +{{- if not .Site.Params.assets.disableFingerprinting }} +{{- $highlight := slice (resources.Get "js/highlight.min.js") | resources.Concat "assets/js/highlight.js" | minify | fingerprint }} + +{{- else }} +{{- $highlight := slice (resources.Get "js/highlight.min.js") | resources.Concat "assets/js/highlight.js" | minify }} + +{{- end }} +{{- end }} + +{{- /* Favicons */}} + + + + + + + + +{{- /* RSS */}} +{{ range .AlternativeOutputFormats -}} + +{{ end -}} +{{- range .AllTranslations -}} + +{{ end -}} + + + +{{- partial "extend_head.html" . -}} + +{{- /* Misc */}} +{{- if hugo.IsProduction | or (eq .Site.Params.env "production") }} +{{- template "_internal/google_analytics.html" . }} +{{- template "partials/templates/opengraph.html" . }} +{{- template "partials/templates/twitter_cards.html" . }} +{{- template "partials/templates/schema_json.html" . }} +{{- end -}} diff --git a/themes/PaperMod/layouts/partials/header.html b/themes/PaperMod/layouts/partials/header.html new file mode 100644 index 0000000..cc63659 --- /dev/null +++ b/themes/PaperMod/layouts/partials/header.html @@ -0,0 +1,121 @@ +{{- /* theme-toggle is enabled */}} +{{- if (not .Site.Params.disableThemeToggle) }} +{{- /* theme is light */}} +{{- if (eq .Site.Params.defaultTheme "light") }} + +{{- /* theme is dark */}} +{{- else if (eq .Site.Params.defaultTheme "dark") }} + +{{- else }} +{{- /* theme is auto */}} + +{{- end }} +{{- /* theme-toggle is disabled and theme is auto */}} +{{- else if (and (ne .Site.Params.defaultTheme "light") (ne .Site.Params.defaultTheme "dark"))}} + +{{- end }} + +
+ +
diff --git a/themes/PaperMod/layouts/partials/home_info.html b/themes/PaperMod/layouts/partials/home_info.html new file mode 100644 index 0000000..4db55d7 --- /dev/null +++ b/themes/PaperMod/layouts/partials/home_info.html @@ -0,0 +1,13 @@ +{{- with $.Site.Params.homeInfoParams }} +
+
+

{{ .Title | markdownify }}

+
+
+

{{ .Content | markdownify }}

+
+
+ {{ partial "social_icons.html" $.Site.Params.socialIcons }} +
+
+{{- end -}} diff --git a/themes/PaperMod/layouts/partials/index_profile.html b/themes/PaperMod/layouts/partials/index_profile.html new file mode 100644 index 0000000..4e961ba --- /dev/null +++ b/themes/PaperMod/layouts/partials/index_profile.html @@ -0,0 +1,23 @@ +
+ {{- with .Site.Params.profileMode }} +
+ {{- if .imageUrl -}} + {{ .imageTitle | default + {{- end }} +

{{ .title | default $.Site.Title | markdownify }}

+ {{ .subtitle | markdownify }} + {{- partial "social_icons.html" $.Site.Params.socialIcons -}} + + {{- with .buttons }} +
+ {{- range . }} + + {{ .name | title }} + + {{- end }} +
+ {{- end }} +
+ {{- end}} +
diff --git a/themes/PaperMod/layouts/partials/post_canonical.html b/themes/PaperMod/layouts/partials/post_canonical.html new file mode 100644 index 0000000..9befad1 --- /dev/null +++ b/themes/PaperMod/layouts/partials/post_canonical.html @@ -0,0 +1,9 @@ +{{ if and (.Params.canonicalURL) (.Params.ShowCanonicalLink ) -}} +{{ $url := urls.Parse .Params.canonicalURL }} + +{{- if or .Params.author $.Site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) .IsTranslated (or .Params.editPost.URL .Site.Params.editPost.URL) }} | {{- end -}} + + {{- (.Site.Params.CanonicalLinkText | default .Params.CanonicalLinkText) | default "Originally published at" -}} +  {{ $url.Host }} + +{{- end }} diff --git a/themes/PaperMod/layouts/partials/post_meta.html b/themes/PaperMod/layouts/partials/post_meta.html new file mode 100644 index 0000000..f7134fb --- /dev/null +++ b/themes/PaperMod/layouts/partials/post_meta.html @@ -0,0 +1,21 @@ +{{- $scratch := newScratch }} + +{{- if not .Date.IsZero -}} +{{- $scratch.Add "meta" (slice (printf "%s" (.Date) (.Date | time.Format (default "January 2, 2006" .Site.Params.DateFormat)))) }} +{{- end }} + +{{- if (.Param "ShowReadingTime") -}} +{{- $scratch.Add "meta" (slice (i18n "read_time" .ReadingTime | default (printf "%d min" .ReadingTime))) }} +{{- end }} + +{{- if (.Param "ShowWordCount") -}} +{{- $scratch.Add "meta" (slice (i18n "words" .WordCount | default (printf "%d words" .WordCount))) }} +{{- end }} + +{{- with (partial "author.html" .) }} +{{- $scratch.Add "meta" (slice .) }} +{{- end }} + +{{- with ($scratch.Get "meta") }} +{{- delimit . " · " -}} +{{- end -}} diff --git a/themes/PaperMod/layouts/partials/post_nav_links.html b/themes/PaperMod/layouts/partials/post_nav_links.html new file mode 100644 index 0000000..b988641 --- /dev/null +++ b/themes/PaperMod/layouts/partials/post_nav_links.html @@ -0,0 +1,19 @@ +{{- $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} +{{- if and (gt (len $pages) 1) (in $pages . ) }} + +{{- end }} diff --git a/themes/PaperMod/layouts/partials/share_icons.html b/themes/PaperMod/layouts/partials/share_icons.html new file mode 100644 index 0000000..85c59b3 --- /dev/null +++ b/themes/PaperMod/layouts/partials/share_icons.html @@ -0,0 +1,71 @@ +{{- $pageurl := .Permalink }} +{{- $title := .Title }} + +{{- $.Scratch.Set "tags" ""}} + +{{- with .Params.Tags }} +{{- $hashtags := newScratch}} +{{- range . }}{{ $hashtags.Add "tags" (slice (replaceRE "(\\s)" "" . ))}}{{end}} +{{- $.Scratch.Set "tags" (delimit ($hashtags.Get "tags") ",") }} +{{- end -}} + +{{- $custom := false }} +{{- $ShareButtons := (.Param "ShareButtons")}} +{{- with $ShareButtons }}{{ $custom = true }}{{ end }} + +
+ {{- if (cond ($custom) (in $ShareButtons "twitter") (true)) }} + + + + + + {{- end }} + {{- if (cond ($custom) (in $ShareButtons "linkedin") (true)) }} + + + + + + {{- end }} + {{- if (cond ($custom) (in $ShareButtons "reddit") (true)) }} + + + + + + {{- end }} + {{- if (cond ($custom) (in $ShareButtons "facebook") (true)) }} + + + + + + {{- end }} + {{- if (cond ($custom) (in $ShareButtons "whatsapp") (true)) }} + + + + + + {{- end }} + {{- if (cond ($custom) (in $ShareButtons "telegram") (true)) }} + + + + + + {{- end }} +
diff --git a/themes/PaperMod/layouts/partials/social_icons.html b/themes/PaperMod/layouts/partials/social_icons.html new file mode 100644 index 0000000..7c16e30 --- /dev/null +++ b/themes/PaperMod/layouts/partials/social_icons.html @@ -0,0 +1,7 @@ +
+ {{- range . }} + + {{ partial "svg.html" . }} + + {{- end }} +
diff --git a/themes/PaperMod/layouts/partials/svg.html b/themes/PaperMod/layouts/partials/svg.html new file mode 100644 index 0000000..f8f8963 --- /dev/null +++ b/themes/PaperMod/layouts/partials/svg.html @@ -0,0 +1,518 @@ +{{- $icon_name := ( trim .name " " | lower )}} +{{- if (eq $icon_name "123rf") -}} + + + + +{{- else if (eq $icon_name "adobestock") -}} + + + + +{{- else if (eq $icon_name "behance") -}} + + + +{{- else if (eq $icon_name "bilibili") -}} + + + + + + + +{{- else if (eq $icon_name "buymeacoffee") -}} + + + + + + + + + + + + + + + + +{{- else if (eq $icon_name "codepen") -}} + + + + + + + +{{- else if (eq $icon_name "cryptohack") -}} + + + + + + +{{- else if (eq $icon_name "ctftime") -}} + + + + + + +{{- else if (eq $icon_name "cv") -}} + + + + + + +{{- else if (eq $icon_name "dev") -}} + + + +{{- else if (eq $icon_name "deezer") -}} + + + +{{- else if (eq $icon_name "discogs") -}} + + + +{{- else if (eq $icon_name "discord") -}} + + + + +{{- else if (eq $icon_name "dreamstime") -}} + + + +{{- else if (eq $icon_name "dribbble") -}} + + + + + +{{- else if (eq $icon_name "email") -}} + + + + +{{- else if (eq $icon_name "facebook") -}} + + + +{{- else if (eq $icon_name "flickr") -}} + + + +{{- else if (eq $icon_name "freepik") -}} + + + + + + +{{- else if (eq $icon_name "gitea") -}} + + + +{{- else if (eq $icon_name "github") -}} + + + + +{{- else if (eq $icon_name "gitlab") -}} + + + + +{{- else if (eq $icon_name "goodreads") -}} + + + +{{- else if (eq $icon_name "googlescholar") -}} + + + +{{- else if (eq $icon_name "hackerone") -}} + + + +{{- else if (eq $icon_name "hackerrank") -}} + + + + + + +{{- else if (eq $icon_name "hackthebox") -}} + + + + + + +{{- else if (eq $icon_name "instagram") -}} + + + + + +{{- else if (eq $icon_name "itchio") -}} + + + +{{- else if (eq $icon_name "kaggle") -}} + + + +{{- else if (eq $icon_name "kakaotalk") -}} + + + + + + + +{{- else if (eq $icon_name "keybase") -}} + + + +{{- else if (eq $icon_name "kofi") -}} + + + +{{- else if (eq $icon_name "komoot") -}} + + + +{{- else if (eq $icon_name "lastfm") -}} + + + +{{- else if (eq $icon_name "letterboxd") -}} + + + +{{- else if (eq $icon_name "liberapay") -}} + + + + + + +{{- else if (eq $icon_name "linkedin") -}} + + + + + +{{- else if (eq $icon_name "mastodon") -}} + + + + +{{- else if (eq $icon_name "matrix") -}} + + + +{{- else if (eq $icon_name "medium") -}} + + + + + +{{- else if (eq $icon_name "mixcloud") -}} + + + +{{- else if (eq $icon_name "nuget") -}} + + + + + + + + +{{- else if (eq $icon_name "paypal") -}} + + + +{{- else if or (eq $icon_name "pgpkey") (eq $icon_name "key") -}} + + + + +{{- else if (eq $icon_name "phone") -}} + + + + + +{{- else if (eq $icon_name "polywork") -}} + +{{- else if (eq $icon_name "qq") -}} + + + + +{{- else if (eq $icon_name "reddit") -}} + + + +{{- else if (eq $icon_name "researchgate") -}} + + + +{{- else if (eq $icon_name "rss") -}} + + + + + +{{- else if (eq $icon_name "serverfault") -}} + + + +{{- else if (eq $icon_name "soundcloud") -}} + + + +{{- else if (eq $icon_name "shutterstock") -}} + + + + +{{- else if (eq $icon_name "slack") -}} + + + + + + + +{{- else if (eq $icon_name "snapchat") -}} + + + +{{- else if (eq $icon_name "sourcerer") -}} + + + + + + + + + + + + +{{- else if (eq $icon_name "spotify") -}} + + + +{{- else if (eq $icon_name "stackoverflow") -}} + + + +{{- else if (eq $icon_name "steam") -}} + + + +{{- else if (eq $icon_name "telegram") -}} + + + +{{- else if (eq $icon_name "twitch") -}} + + + +{{- else if (eq $icon_name "twitter") -}} + + + + +{{- else if (eq $icon_name "unsplash") -}} + + + + +{{- else if (eq $icon_name "xda") -}} + + + +{{- else if (eq $icon_name "xing") -}} + + + + +{{- else if (eq $icon_name "ycombinator") -}} + + + +{{- else if (eq $icon_name "youtube") -}} + + + + + +{{- else if $icon_name -}} + + + + +{{- end -}} diff --git a/themes/PaperMod/layouts/partials/templates/opengraph.html b/themes/PaperMod/layouts/partials/templates/opengraph.html new file mode 100644 index 0000000..9bbd90b --- /dev/null +++ b/themes/PaperMod/layouts/partials/templates/opengraph.html @@ -0,0 +1,52 @@ + + + + +{{- if .Params.cover.image -}} +{{- if (ne .Params.cover.relative true) }} + +{{- else}} + +{{- end}} +{{- else }} + +{{- with $.Params.images -}} +{{- range first 6 . }}{{ end -}} +{{- else -}} +{{- $images := $.Resources.ByType "image" -}} +{{- $featured := $images.GetMatch "*feature*" -}} +{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} +{{- with $featured -}} + +{{- else -}} +{{- with $.Site.Params.images }}{{ end -}} +{{- end -}} +{{- end -}} +{{- end }} + +{{- if .IsPage }} +{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} + +{{ with .PublishDate }}{{ end }} +{{ with .Lastmod }}{{ end }} +{{- end -}} + +{{- with .Params.audio }}{{ end }} +{{- with .Params.locale }}{{ end }} +{{- with .Site.Params.title }}{{ end }} +{{- with .Params.videos }}{{- range . }} + +{{ end }}{{ end }} + +{{- /* If it is part of a series, link to related articles */}} +{{- $permalink := .Permalink }} +{{- $siteSeries := .Site.Taxonomies.series }} +{{ with .Params.series }}{{- range $name := . }} + {{- $series := index $siteSeries ($name | urlize) }} + {{- range $page := first 6 $series.Pages }} + {{- if ne $page.Permalink $permalink }}{{ end }} + {{- end }} +{{ end }}{{ end }} + +{{- /* Facebook Page Admin ID for Domain Insights */}} +{{- with .Site.Social.facebook_admin }}{{ end }} diff --git a/themes/PaperMod/layouts/partials/templates/schema_json.html b/themes/PaperMod/layouts/partials/templates/schema_json.html new file mode 100644 index 0000000..5cf3857 --- /dev/null +++ b/themes/PaperMod/layouts/partials/templates/schema_json.html @@ -0,0 +1,119 @@ +{{ if .IsHome }} + +{{- else if (or .IsPage .IsSection) }} +{{/* BreadcrumbList */}} +{{- $url := replace .Parent.Permalink ( printf "%s" .Site.BaseURL) "" }} +{{- $lang_url := strings.TrimPrefix ( printf "%s/" .Lang) $url }} +{{- $bc_list := (split $lang_url "/")}} + +{{- $scratch := newScratch }} + +{{- if .IsPage }} + +{{- end }}{{/* .IsPage end */}} + +{{- end -}} diff --git a/themes/PaperMod/layouts/partials/templates/twitter_cards.html b/themes/PaperMod/layouts/partials/templates/twitter_cards.html new file mode 100644 index 0000000..02270de --- /dev/null +++ b/themes/PaperMod/layouts/partials/templates/twitter_cards.html @@ -0,0 +1,33 @@ +{{- if .Params.cover.image -}} + +{{- if (ne $.Params.cover.relative true) }} + +{{- else }} + +{{- end}} +{{- else }} +{{- with $.Params.images -}} + + +{{ else -}} +{{- $images := $.Resources.ByType "image" -}} +{{- $featured := $images.GetMatch "*feature*" -}} +{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} +{{- with $featured -}} + + +{{- else -}} +{{- with $.Site.Params.images -}} + + +{{ else -}} + +{{- end -}} +{{- end -}} +{{- end }} +{{- end }} + + +{{ with .Site.Social.twitter -}} + +{{ end -}} diff --git a/themes/PaperMod/layouts/partials/toc.html b/themes/PaperMod/layouts/partials/toc.html new file mode 100644 index 0000000..d9b8b23 --- /dev/null +++ b/themes/PaperMod/layouts/partials/toc.html @@ -0,0 +1,97 @@ +{{- $headers := findRE "(.|\n])+?
" .Content -}} +{{- $has_headers := ge (len $headers) 1 -}} +{{- if $has_headers -}} +
+
+ + {{- i18n "toc" | default "Table of Contents" }} + + +
+ {{- if (.Param "UseHugoToc") }} + {{- .TableOfContents -}} + {{- else }} + {{- $largest := 6 -}} + {{- range $headers -}} + {{- $headerLevel := index (findRE "[1-6]" . 1) 0 -}} + {{- $headerLevel := len (seq $headerLevel) -}} + {{- if lt $headerLevel $largest -}} + {{- $largest = $headerLevel -}} + {{- end -}} + {{- end -}} + + {{- $firstHeaderLevel := len (seq (index (findRE "[1-6]" (index $headers 0) 1) 0)) -}} + + {{- $.Scratch.Set "bareul" slice -}} +
    + {{- range seq (sub $firstHeaderLevel $largest) -}} +
      + {{- $.Scratch.Add "bareul" (sub (add $largest .) 1) -}} + {{- end -}} + {{- range $i, $header := $headers -}} + {{- $headerLevel := index (findRE "[1-6]" . 1) 0 -}} + {{- $headerLevel := len (seq $headerLevel) -}} + + {{/* get id="xyz" */}} + {{- $id := index (findRE "(id=\"(.*?)\")" $header 9) 0 }} + + {{- /* strip id="" to leave xyz, no way to get regex capturing groups in hugo */ -}} + {{- $cleanedID := replace (replace $id "id=\"" "") "\"" "" }} + {{- $header := replaceRE "((.|\n])+?)" "$1" $header -}} + + {{- if ne $i 0 -}} + {{- $prevHeaderLevel := index (findRE "[1-6]" (index $headers (sub $i 1)) 1) 0 -}} + {{- $prevHeaderLevel := len (seq $prevHeaderLevel) -}} + {{- if gt $headerLevel $prevHeaderLevel -}} + {{- range seq $prevHeaderLevel (sub $headerLevel 1) -}} +
        + {{/* the first should not be recorded */}} + {{- if ne $prevHeaderLevel . -}} + {{- $.Scratch.Add "bareul" . -}} + {{- end -}} + {{- end -}} + {{- else -}} + + {{- if lt $headerLevel $prevHeaderLevel -}} + {{- range seq (sub $prevHeaderLevel 1) -1 $headerLevel -}} + {{- if in ($.Scratch.Get "bareul") . -}} +
      + {{/* manually do pop item */}} + {{- $tmp := $.Scratch.Get "bareul" -}} + {{- $.Scratch.Delete "bareul" -}} + {{- $.Scratch.Set "bareul" slice}} + {{- range seq (sub (len $tmp) 1) -}} + {{- $.Scratch.Add "bareul" (index $tmp (sub . 1)) -}} + {{- end -}} + {{- else -}} +
    + + {{- end -}} + {{- end -}} + {{- end -}} + {{- end }} +
  • + {{- $header | safeHTML -}} + {{- else }} +
  • + {{- $header | safeHTML -}} + {{- end -}} + {{- end -}} + + {{- $firstHeaderLevel := $largest }} + {{- $lastHeaderLevel := len (seq (index (findRE "[1-6]" (index $headers (sub (len $headers) 1)) 1) 0)) }} +
  • + {{- range seq (sub $lastHeaderLevel $firstHeaderLevel) -}} + {{- if in ($.Scratch.Get "bareul") (add . $firstHeaderLevel) }} +
+ {{- else }} + + + {{- end -}} + {{- end }} + + {{- end }} +
+
+
+{{- end }} diff --git a/themes/PaperMod/layouts/partials/translation_list.html b/themes/PaperMod/layouts/partials/translation_list.html new file mode 100644 index 0000000..e1c34e1 --- /dev/null +++ b/themes/PaperMod/layouts/partials/translation_list.html @@ -0,0 +1,19 @@ +{{- if .IsTranslated -}} +{{- if (ne .Layout "search") }} +{{- if or .Params.author $.Site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) }} | {{- end -}} +{{- end }} + +{{- end -}} -- cgit v1.2.3