diff options
Diffstat (limited to 'layouts/partials')
-rw-r--r-- | layouts/partials/attribution.html | 61 | ||||
-rw-r--r-- | layouts/partials/author_card.html | 23 | ||||
-rw-r--r-- | layouts/partials/footer.html | 38 | ||||
-rw-r--r-- | layouts/partials/head.html | 90 | ||||
-rw-r--r-- | layouts/partials/header.html | 102 | ||||
-rw-r--r-- | layouts/partials/hero.html | 44 | ||||
-rw-r--r-- | layouts/partials/image-gallery.html | 30 | ||||
-rw-r--r-- | layouts/partials/leading_image.html | 31 | ||||
-rw-r--r-- | layouts/partials/meta.html | 15 | ||||
-rw-r--r-- | layouts/partials/meta_links.html | 14 | ||||
-rw-r--r-- | layouts/partials/metadata.html | 61 | ||||
-rw-r--r-- | layouts/partials/pagination.html | 35 | ||||
-rw-r--r-- | layouts/partials/post.html | 34 | ||||
-rw-r--r-- | layouts/partials/post_pager.html | 20 | ||||
-rw-r--r-- | layouts/partials/social_links.html | 16 | ||||
-rw-r--r-- | layouts/partials/structured-data.html | 102 | ||||
-rw-r--r-- | layouts/partials/tipping.html | 0 |
17 files changed, 578 insertions, 138 deletions
diff --git a/layouts/partials/attribution.html b/layouts/partials/attribution.html new file mode 100644 index 0000000..e69341b --- /dev/null +++ b/layouts/partials/attribution.html @@ -0,0 +1,61 @@ +<div class="border-t border-gray-500 py-4 my-2"> + {{ if in (slice "by" "by-nd" "by-sa" "by-nc" "by-nc-nd" "by-nc-sa") .license }} + {{ $href := printf "http://creativecommons.org/licenses/%s/4.0/" .license }} + <div + xmlns:cc="http://creativecommons.org/ns#" + xmlns:dct="http://purl.org/dc/terms/" + > + <span property="dct:title">The content in this website</span> + by + {{ with .Author.homepage }} + <a + rel="cc:attributionURL dct:creator" + property="cc:attributionName" + href="{{ . }}" + class="hover:opacity-50" + > + {{ $.Author.name }} + </a> + {{ else }} + {{ $.Author.name }} + {{ end }} + + is licensed under a + <a + target="_blank" + rel="license noopener noreferrer" + href="{{ $href }}" + class="block hover:opacity-50" + > + Creative Commons + {{ with .license }} + Attribution{{- if in . "by-nc" -}} + -NonCommercial + {{- end -}}{{- if in . "-nd" -}} + -NoDerivatives + {{- else if in . "-sa" -}} + -ShareAlike + {{- end -}} + {{ end }} + 4.0 International License + <span class="block m-2"> + <i class="text-4xl fab fa-creative-commons"></i> + <i class="text-4xl fab fa-creative-commons-by"></i> + {{ with .license }} + {{ if in . "by-nc" }} + <i class="text-4xl fab fa-creative-commons-nc"></i> + {{ end }}{{ if in . "-nd" }} + <i class="text-4xl fab fa-creative-commons-nd"></i> + {{ else if in . "-sa" }} + <i class="text-4xl fab fa-creative-commons-sa"></i> + {{ end }} + {{ end }} + </span> + </a> + </div> + {{ else }} + Copyright © + {{ now.Format "2006" }} + {{ .Author.name }} + {{ end }} +</div> diff --git a/layouts/partials/author_card.html b/layouts/partials/author_card.html new file mode 100644 index 0000000..b23c3e7 --- /dev/null +++ b/layouts/partials/author_card.html @@ -0,0 +1,23 @@ +<article + class="max-w-screen-md mx-auto p-8 md:flex md:flex-row items-start border-t" +> + <img + src="{{ .avatar }}" + class="rounded-full w-16 mx-auto md:m-4" + alt="{{ .name }}" + /> + <div class=""> + <h5 class="my-0 berkshire-swash"> + <a href="{{ (default .path .homepage) }}" class=""> + {{ .name }} + </a> + </h5> + <h6 class="font-light p-0 m-0">{{ .role | markdownify }}</h6> + <p class="mt-3"> + {{ .bio }} + </p> + <div class="text-xl mt-4"> + {{ partial "social_links" . }} + </div> + </div> +</article> diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index d4216d8..4a977f1 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,5 +1,35 @@ -<footer id="footer" class="center pa2 bg-white-40"> - <span class="db tc black-80"> - © {{ now.Format "2006" }} {{ with .Site.Params.footer.copyright }}{{ . | safeHTML }}{{ else }}{{ with .Site.Author.name }}{{ . }}{{ else }}{{ with .Site.Title }}{{ . }}{{ end }}{{ end }}{{ end }}. All Rights Reserved - </span> +<footer class="bg-black w-full p-4 text-center text-white text-lg"> + <div class="max-w-screen-md mx-auto"> + {{ if in .Site.Params.mainSections .Section }} + <a href="/{{ .Section }}/index.xml" class="block my-2 hover:opacity-50"> + {{ T "rss_follow" (dict "section" (T .Section)) }} + <i class="fa-solid fa-rss"></i> + </a> + {{ end }} + + {{ range .Site.Menus.footer }} + <a + class="inline hover:opacity-50 text-base p-2" + href="{{ .URL | relLangURL }}" + >{{ T .Name | safeHTML }} + </a> + {{ end }} + + {{ with .Site.GetPage "footer.md" }} + {{ .Content }} + {{ end }} + + {{ partial "attribution.html" .Site.Params }} + + <div class="my-2"> + Made in anger with + <a + href="https://git.oscarnajera.com/hugo-minimalist-theme/about/" + class="silver hover-near-white" + > + hugo-minimalist + </a> + theme. + </div> + </div> </footer> diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 2cb900d..f3919c4 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,53 +1,37 @@ -<meta name="viewport" content="width=device-width, initial-scale=1"> -<meta charset="UTF-8"> -<link rel="stylesheet" href="https://unpkg.com/tachyons@4.10.0/css/tachyons.min.css"/> -<!-- FontAwesome --> -<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"> - -<!-- CustomCSS --> - {{ range .Site.Params.customCSS }} - {{ if isset . "href" }} - <link {{ if not (isset . "rel") }}rel="stylesheet" {{ end }}{{ range $key, $value := . }} {{ if eq $key "href" }}{{ (printf "%s=\"%s\"" $key ($value | absURL)) | safeHTMLAttr }}{{ else }}{{ (printf "%s=\"%s\"" $key (string $value)) | safeHTMLAttr }}{{ end }}{{ end }}> - {{ else }} - <link rel="stylesheet" href="{{ . | absURL }}"> - {{ end }} - {{ end }} - -<!-- Highligth.js --> -<link rel="stylesheet" - href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/zenburn.min.css"> -<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script> -<script>hljs.initHighlightingOnLoad();</script> - -<!-- Mathjax --> -<script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-MML-AM_CHTML' async></script> - -<!-- CSS --> -<style> - a { - text-decoration: none; - color: #357edd; - } - - #sidebar { - text-shadow: 1px 1px 1px #111; - } - - .post-header { - text-shadow: 1px 2px 1px rgba(0,0,0,0.9); - } - - pre { - background: #3f3f3f; - color: #dcdcdc; - padding: 0.5em;} - -</style> -<script> - function w3_open() { - document.getElementById("sidebar").style.display = "block"; - } - function w3_close() { - document.getElementById("sidebar").style.display = "none"; - } -</script> +<head> + {{ partial "structured-data.html" . }} + + {{ with resources.Get "css/tailwind.css" | resources.Minify | fingerprint }} + <link + rel="stylesheet" + href="{{ .RelPermalink }}" + integrity="{{ .Data.Integrity }}" + crossorigin="anonymous" + type="text/css" + media="screen" + /> + {{ end }} + + {{ with resources.Get .Site.Params.favicon }} + <link rel="icon" href="{{ .RelPermalink }}" /> + {{ end }} + {{ range .AlternativeOutputFormats -}} + {{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} + {{ end -}} + + + <script + async + src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js" + ></script> + + {{ with resources.Get "js/loads.js" | resources.Minify | fingerprint }} + <script + async + src="{{ .RelPermalink }}" + integrity="{{ .Data.Integrity }}" + crossorigin="anonymous" + referrerpolicy="no-referrer" + ></script> + {{ end }} +</head> diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 41bfd71..33f5ad2 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,65 +1,51 @@ -{{ if .Site.Author.gravataremail }} - {{ .Scratch.Set "authorPicture" (printf "//www.gravatar.com/avatar/%s" (urlize (md5 (.Site.Author.gravataremail )))) }} -{{ else if .Site.Author.picture }} - {{ .Scratch.Set "authorPicture" (absURL .Site.Author.picture) }} -{{ end }} - -<nav id="sidebar" class="w5-ns w-100 bg-gray vh-100 fixed z-2 overflow-auto dn" style="background-image:url('{{ .Site.Params.coverImage | absURL }}');"> - <a class="bg-black white link dim db pa3 tc pointer" onclick="w3_close()"> - Close × +<nav class="bg-lime-700"> + <div + class="max-w-screen-md mx-auto text-white flex justify-between items-center" + > + <a href="{{ site.BaseURL | relLangURL }}" class=""> + {{ with resources.Get .Site.Params.logo }} + <img + height="{{ site.Params.logo_height }}" + class="v-btm" + src="{{ .Permalink }}" + alt="{{ site.Title }}" + /> + {{ end }} + <span class="pl-2 text-4xl leading-normal berkshire-swash"> + {{ .Site.Title }} + </span> </a> - - <div class="tc pv4"> - <a href="/#about" class="white link"> - {{ with ($.Scratch.Get "authorPicture") }} - <img class="br-100" src="{{ . }}{{ if in . "//www.gravatar.com/avatar/" }}?s=110{{ end }}"/> - {{ end }} - <h3 class="f3"> - {{ .Site.Author.name }} - </h3> + <input class="menu-btn hidden" type="checkbox" id="menu-btn" /> + <label class="menu-icon p-2 md:hidden" for="menu-btn"> + <span class="navicon bg-white"></span> + </label> + <div + class="menu bg-lime-700 md:w-fit md:flex-row md:max-h-none md:static top-12" + > + {{ range .Site.Menus.main }} + <a class="hover:bg-lime-500 p-4" href="{{ .PageRef | relLangURL }}"> + {{ .Pre }} + {{- T .Name | title -}} </a> + {{ end }} </div> - <ul class="list"> - {{ range .Site.Menus.main }} - <li class="pv2"> - <a class="link white db grow" href="{{ .URL | relLangURL }}" title="{{ .Title }}"> - {{ .Pre }} {{ .Name }}</a> - </li> - {{ end }} - </ul> - <ul class="list"> - {{ range .Site.Menus.links }} - <li class="pv2"> - <a class="link white db grow" href="{{ .URL | relLangURL }}" title="{{ .Title }}"> - {{ .Pre }} {{ .Name }}</a> - </li> - {{ end }} - </ul> - <ul class="list"> - {{ range .Site.Menus.misc }} - <li class="pv2"> - <a class="link white db grow" href="{{ .URL | relLangURL }}" title="{{ .Title }}"> - {{ .Pre }} {{ .Name }}</a> - </li> + {{ if .IsTranslated }} + <select + name="lang" + class="mr-2 p-1 text-center border border-black-20 rounded-md bg-white text-black" + onchange="self.location=options[selectedIndex].value" + > + <option value="{{ .Permalink }}"> + {{ .Language.Lang }} + </option> + {{ range .Translations }} + <option value="{{ .Permalink }}"> + {{ .Language.Lang }} + </option> {{ end }} - </ul> - -</nav> - -<nav class="fixed z-1 dt w-100 border-box pa2 bb b--black-30 bg-near-white"> - - <a class="dtc dib v-mid dim " onclick="w3_open()"> - <i class="fa fa-lg fa-bars black"></i> - </a> - - <a href="{{ "/" | relLangURL }}" class="dtc v-mid link dim tc"> - <div class="f4 dib black-80 b">{{ .Site.Title }}</div> - </a> - - {{ with ($.Scratch.Get "authorPicture") }} - <a href="/#about" class="dtc dim tr"> - <img class="dib v-mid dib w2 h2 br-100" src="{{ . }}{{ if in . "//www.gravatar.com/avatar/" }}?s=90{{ end }}"/> - </a> + </select> {{ end }} + + </div> </nav> diff --git a/layouts/partials/hero.html b/layouts/partials/hero.html new file mode 100644 index 0000000..55551a0 --- /dev/null +++ b/layouts/partials/hero.html @@ -0,0 +1,44 @@ +<div + id="hero" + class="py-16" + style="background: linear-gradient( rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.15) ){{ with resources.Get (index .Params.images 0) }} + {{ with .Resize "1200x webp" }} + , url('{{ .RelPermalink }}') center + {{ end }} + {{ end }};" +> + <div class="max-w-screen-md mx-auto px-2 text-white font-serif"> + {{ if eq .Type "authors" }} + {{ $avatar := index .Params.images 1 }} + {{ if hasPrefix $avatar "http" }} + {{ $avatar = resources.GetRemote $avatar }} + {{ else }} + {{ $avatar = resources.Get $avatar }} + {{ end }} + {{ with $avatar }} + <img + src="{{ .RelPermalink }}" + class="rounded-full w-64 block mx-auto" + alt="" + /> + {{ end }} + <div class="text-center"> + <h1 class="">{{ .Params.Name }}</h1> + <h3 class="font-normal">{{ .Params.role | markdownify }}</h3> + + {{ with .Params.Subtitle }} + <h3 class="">{{ . | markdownify }}</h3> + {{ end }} + + + <div class="text-4xl mt-4"> + {{ partial "social_links" .Params }} + </div> + </div> + {{ else }} + + <h1 class="berkshire-swash text-center">{{ .Title }}</h1> + {{ .Content }} + {{ end }} + </div> +</div> diff --git a/layouts/partials/image-gallery.html b/layouts/partials/image-gallery.html new file mode 100644 index 0000000..3825f16 --- /dev/null +++ b/layouts/partials/image-gallery.html @@ -0,0 +1,30 @@ +{{ with .Params.album }} + <section class="gallery flex relative my-3 mx-auto"> + {{ range $id, $val := readDir (printf "/assets/media/albums/%s" (string .)) }} + {{ with resources.Get (printf "media/albums/%s/%s" $.Params.album $val.Name) }} + <div class=""> + <input + type="radio" + id="img-{{ $id }}" + checked + name="gallery" + class="absolute hidden" + /> + <img + class="transition-opacity duration-300 absolute top-0 left-0 opacity-0" + src="{{ (.Fill "1152x768").RelPermalink }}" + alt="" + loading="lazy" + /> + <label for="img-{{ $id }}" class="block m-2 p-2"> + <img + src="{{ (.Fill "150x100").RelPermalink }}" + alt="" + loading="lazy" + /> + </label> + </div> + {{ end }} + {{ end }} + </section> +{{ end }} diff --git a/layouts/partials/leading_image.html b/layouts/partials/leading_image.html new file mode 100644 index 0000000..1b5cf28 --- /dev/null +++ b/layouts/partials/leading_image.html @@ -0,0 +1,31 @@ +{{ $image := "" }} +{{ if (.Resources.ByType "image").GetMatch "*featured*" }} + {{ $image = (.Resources.ByType "image").GetMatch "*featured*" }} +{{ else if resources.Get (index .Params.images 0) }} + {{ $image = resources.Get (index .Params.images 0) }} +{{ end }} +{{ with $image }} + <div class="text-center"> + <div class="relative inline-block"> + <img + {{ if ne .MediaType.SubType "svg" }} + {{ $image := .Fit (default "768x400 webp" $.Params.image_size) }} + width="{{ $image.Width }}" height="{{ $image.Height }}" + src="{{ $image.RelPermalink }}" + {{ else }} + src="{{ $image.RelPermalink }}" + {{ end }} + class="m-0" + alt="{{ .Title }}" + /> + {{ with $.Params.caption }} + <a + href="{{ .url }}" + class="text-white block absolute bottom-0 right-0 p-2 bg-black bg-opacity-40 rounded" + > + {{ .text }} + </a> + {{ end }} + </div> + </div> +{{ end }} diff --git a/layouts/partials/meta.html b/layouts/partials/meta.html deleted file mode 100644 index 84e76e5..0000000 --- a/layouts/partials/meta.html +++ /dev/null @@ -1,15 +0,0 @@ -{{ with .Params.categories }} -<i class="fa fa-lg fa-bookmark"></i> -{{ range . }} -<a class="link underline-hover white mr3" - href="{{ $.Site.LanguagePrefix }}/categories/{{ . | urlize }}/">{{ . }}</a> -{{ end }} -{{ end }} - -{{ with .Params.tags }} -<i class="fa fa-lg fa-tags"></i> -{{ range . }} -<a class="link underline-hover white" - href="{{ $.Site.LanguagePrefix }}/tags/{{ . | urlize }}/">{{ . }}</a> -{{ end }} -{{ end }} diff --git a/layouts/partials/meta_links.html b/layouts/partials/meta_links.html new file mode 100644 index 0000000..69e2a94 --- /dev/null +++ b/layouts/partials/meta_links.html @@ -0,0 +1,14 @@ +{{ with .Params.meta_links }} + <div class="px-8 text-right"> + {{ range $key, $val := . }} + <a + class="inline-block text-sm border border-current rounded-lg mx-1 px-2 py-1 text-lime-500 hover:bg-lime-500 uppercase" + href="{{ . }}" + target="_blank" + rel="noopener" + > + {{ $key }} + </a> + {{ end }} + </div> +{{ end }} diff --git a/layouts/partials/metadata.html b/layouts/partials/metadata.html new file mode 100644 index 0000000..8679be6 --- /dev/null +++ b/layouts/partials/metadata.html @@ -0,0 +1,61 @@ +{{ $dateTime := .PublishDate.Format "2006-01-02" }} +{{ $dateFormat := .Site.Params.dateFormat | default ":date_medium" }} +<div class="text-sm my-0 px-8 py-2"> + {{ T "author_by" }} — + {{ range .Params.authors }} + {{ $name := . }} + {{ $path := printf "/%s/%s" "authors" ( $name | urlize ) }} + {{ with $.GetPage $path }} + {{ if isset .Params "name" }} + <a class="underline" href="{{ .RelPermalink }}"> + {{- default $name .Params.name -}} + </a> + {{ else }} + {{ $name }} + {{ end }} + {{ else }} + {{ $name }} + {{ end }} + {{ end }} + + + <br /> + <i class="far fa-calendar"></i> + <time datetime="{{ $dateTime }}"> + {{ time.Format $dateFormat .Date }} + </time> + {{ with .Params.location }} + — + {{ . }} + {{ end }} + + {{ if eq .Section "post" }} + | + {{ .ReadingTime }} + {{ i18n "minute_read" }} + {{ end }} + + {{ with .GetTerms "tags" }} + | + <a href="/tags" class="text-lime-500 px-1"> + <i class="fas fa-tags"></i> + </a> + {{ range . }} + <a class="underline" href="{{ .RelPermalink }}"> + {{- .Title -}} + </a> + {{ end }} + {{ end }} + + {{ with .GetTerms "categories" }} + | + <a href="/categories" class="text-lime-500 px-1"> + <i class="fas fa-folder-open"></i> + </a> + {{ range . }} + <a class="underline" href="{{ .RelPermalink }}"> + {{- .Title -}} + </a> + {{ end }} + {{ end }} +</div> diff --git a/layouts/partials/pagination.html b/layouts/partials/pagination.html index 16ad74e..7e5eeb3 100644 --- a/layouts/partials/pagination.html +++ b/layouts/partials/pagination.html @@ -1,15 +1,34 @@ {{ $pag := $.Paginator }} {{ if gt $pag.TotalPages 1 }} -<div class="center db tc ma4 f6"> + <nav class="flex items-center justify-center p-8"> {{ if $pag.HasPrev }} - <a href="{{ $pag.Prev.URL }}" aria-label="Previous" class="dib link dim ph3 pv2 ba br1 ttu">Newer Posts</a> + <a + href="{{ $pag.Prev.URL }}" + rel="prev" + class="text-black transition hover:scale-105 hover:bg-gray-100 p-2 border" + >« {{ T "prev" }}</a + > {{ end }} - {{ range $pag.Pagers }} - <a href="{{ .URL }}" class="dib link dim ph3 pv2 b ba br1 {{ if eq . $pag }}bg-blue white{{ end }}">{{ .PageNumber }}</a> + {{ if eq . $pag }} + <span class="text-white bg-gray-400 mx-1 p-2 border"> + {{ $pag.PageNumber }}</span + > + {{ else }} + <a + href="{{ .URL }}" + class="block text-black transition hover:scale-105 hover:bg-gray-100 p-2 border" + >{{ .PageNumber }}</a + > + {{ end }} {{ end }} -{{ if $pag.HasNext }} - <a href="{{ $pag.Next.URL }}" aria-label="Next" class="dib link dim ph3 pv2 ba br1 ttu">Older posts</a> -{{ end }} -</div> + {{ if $pag.HasNext }} + <a + href="{{ $pag.Next.URL }}" + rel="next" + class="text-black transition hover:scale-105 hover:bg-gray-100 p-2 border" + >{{ T "next" }} »</a + > + {{ end }} + </nav> {{ end }} diff --git a/layouts/partials/post.html b/layouts/partials/post.html new file mode 100644 index 0000000..8ed64f8 --- /dev/null +++ b/layouts/partials/post.html @@ -0,0 +1,34 @@ +<article class="py-2 border-y border-slate-300"> + {{ partial "meta_links.html" . }} + <a class="block hover:opacity-50 text-slate-900" href="{{ .RelPermalink }}"> + {{ $image := "" }} + {{ if (.Resources.ByType "image").GetMatch "featured*" }} + {{ $image = (.Resources.ByType "image").GetMatch "*featured*" }} + {{ else if resources.Get (index .Params.images 0) }} + {{ $image = resources.Get (index .Params.images 0) }} + {{ end }} + {{ with $image }} + <div class="md:max-w-64 md:float-left mr-4"> + <img + {{ if ne .MediaType.SubType "svg" }} + {{ $image := .Fill (default "150x150" $.Params.thumbnail_size) }} + width="{{ $image.Width }}" height="{{ $image.Height }}" + src="{{ $image.RelPermalink }}" class="mx-auto" + {{ else }} + src="{{ $image.RelPermalink }}" class="mx-auto max-w-64" + {{ end }} + loading="lazy" + alt="" + /> + </div> + {{ end }} + <h3 class="text-2xl baskerville my-1 pb-2 font-bold">{{ .Title }}</h3> + + <p class="md:after:clear-both md:after:block"> + {{ .Summary | replaceRE `<sup.*?><a href.*?#fn:.*?footnote-ref.*?/a></sup>` "" | plainify }} + </p> + </a> + {{ if .Params.metadata }} + {{ partial "metadata.html" . }} + {{ end }} +</article> diff --git a/layouts/partials/post_pager.html b/layouts/partials/post_pager.html new file mode 100644 index 0000000..350f347 --- /dev/null +++ b/layouts/partials/post_pager.html @@ -0,0 +1,20 @@ +<nav class="flex items-center justify-center pa4 f5"> + {{ with .NextInSection }} + <a + href="{{ .RelPermalink }}" + rel="prev" + class="text-black hover:bg-gray-200 p-2 border m-2" + > + « {{ .Title }}</a + > + {{ end }} + {{ with .PrevInSection }} + <a + href="{{ .RelPermalink }}" + rel="prev" + class="text-black hover:bg-gray-200 p-2 border m-2" + > + {{ .Title }} »</a + > + {{ end }} +</nav> diff --git a/layouts/partials/social_links.html b/layouts/partials/social_links.html new file mode 100644 index 0000000..9758891 --- /dev/null +++ b/layouts/partials/social_links.html @@ -0,0 +1,16 @@ +{{ range .social }} + {{ $link := .link }} + {{ $scheme := (urls.Parse $link).Scheme }} + {{ $target := "" }} + {{ if not $scheme }} + {{ $link = .link | relLangURL }} + {{ else if in (slice "http" "https") $scheme }} + {{ $target = "target=\"_blank\" rel=\"noopener\"" }} + {{ end }} + <a + href="{{ $link | safeURL }}" + {{ $target | safeHTMLAttr }} + > + <i class="{{ .icon_class }}"></i> + </a> +{{ end }} diff --git a/layouts/partials/structured-data.html b/layouts/partials/structured-data.html new file mode 100644 index 0000000..c55bcdd --- /dev/null +++ b/layouts/partials/structured-data.html @@ -0,0 +1,102 @@ +<meta charset="utf-8" /> +<meta name="viewport" content="width=device-width, initial-scale=1" /> +{{ $title := print .Site.Title " | " .Title }} +{{ if .IsHome }}{{ $title = .Site.Title }}{{ end }} +<title>{{ $title }}</title> +{{ $image := "" }} +{{ if (.Resources.ByType "image").GetMatch "*featured*" }} + {{ $image = (.Resources.ByType "image").GetMatch "*featured*" }} +{{ else if resources.Get (index .Params.images 0) }} + {{ $image = resources.Get (index .Params.images 0) }} +{{ end }} + +{{ if and $image (ne $image.MediaType.SubType "svg") }} + {{ $image := $image.Fit (default "768x400" $.Params.image_size) }} + <meta name="twitter:card" content="summary_large_image" /> + <meta name="twitter:image" content="{{ $image.Permalink }}" /> + <meta property="og:image" content="{{ $image.Permalink }}" /> +{{ else }} + <meta name="twitter:card" content="summary" /> +{{ end }} +<meta name="twitter:title" content="{{ .Title }}" /> +<meta + name="twitter:description" + content="{{ with .Description }} + {{ . }} + {{ else }} + {{ if .IsPage }} + {{ .Summary }} + {{ else }} + {{ with .Site.Params.description }}{{ . }}{{ end }} + {{ end }} + {{ end -}}" +/> + +<meta property="og:title" content="{{ .Title }}" /> +<meta + property="og:description" + content="{{ with .Description }} + {{ . }} + {{ else }} + {{ if .IsPage }} + {{ .Summary }} + {{ else }} + {{ with .Site.Params.description }}{{ . }}{{ end }} + {{ end }} + {{ end }}" +/> +<meta + property="og:type" + content="{{ if .IsPage }} + article + {{ else }} + website + {{ end }}" +/> +<meta property="og:url" content="{{ .Permalink }}" /> + +{{- if .IsPage }} + {{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} + <meta property="article:section" content="{{ .Section }}" /> + {{ with .PublishDate }} + <meta + property="article:published_time" + {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} + /> + {{ end }} + {{ with .Lastmod }} + <meta + property="article:modified_time" + {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} + /> + {{ end }} +{{- end -}} + +{{- with .Params.audio }}<meta property="og:audio" content="{{ . }}" />{{ end }} +{{- with .Params.locale }} + <meta property="og:locale" content="{{ . }}" /> +{{ end }} +{{- with .Site.Params.title }} + <meta property="og:site_name" content="{{ . }}" /> +{{ end }} +{{- with .Params.videos }} + {{- range . }} + <meta property="og:video" content="{{ . | absURL }}" /> + {{ end }} +{{ end }} + +{{- /* If it is part of a series, link to related articles */}} +{{- $permalink := .Permalink }} +{{- $siteSeries := .Site.Taxonomies.series }} +{{- if $siteSeries }} + {{ with .Params.series }} + {{- range $name := . }} + {{- $series := index $siteSeries ($name | urlize) }} + {{- range $page := first 6 $series.Pages }} + {{- if ne $page.Permalink $permalink }} + <meta property="og:see_also" content="{{ $page.Permalink }}" /> + {{ end }} + {{- end }} + {{ end }} + {{ end }} +{{- end }} diff --git a/layouts/partials/tipping.html b/layouts/partials/tipping.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/layouts/partials/tipping.html |