chore: enable auto-formatting for template files (#133)

This commit is contained in:
Robert Kaussow 2021-12-30 15:55:55 +01:00 committed by GitHub
parent 392708d390
commit b4721c0ce7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 586 additions and 388 deletions

View File

@ -1,10 +1,9 @@
*.html
.drone.yml .drone.yml
search*.js search*.js
_normalize.css _normalize.css
list.json.json list.json.json
.lighthouseci/ /.lighthouseci/
themes/ /themes/
static/js/ /static/js/
src/favicon/ /src/favicon/
LICENSE LICENSE

View File

@ -14,11 +14,15 @@ Include shortcode can include files of different types. By specifying a language
{{< toc >}} {{< toc >}}
## Usage
<!-- prettier-ignore-start -->
```tpl ```tpl
{{</* include file="relative/path/from/hugo/root" language="go" markdown=[false|true] */>}} {{</* include file="relative/path/from/hugo/root" language="go" markdown=[false|true] */>}}
``` ```
<!-- prettier-ignore-end -->
Attributes: ### Attributes
| Name | Usage | default | | Name | Usage | default |
| -------- | ----------------------------------------------------------------------------------------------------------------------------------- | --------------- | | -------- | ----------------------------------------------------------------------------------------------------------------------------------- | --------------- |
@ -38,9 +42,11 @@ If no other options are specified, files will be rendered as Markdown using the
If you include markdown files that should not get a menu entry, place them outside the content folder or exclude them otherwise. If you include markdown files that should not get a menu entry, place them outside the content folder or exclude them otherwise.
{{< /hint >}} {{< /hint >}}
<!-- prettier-ignore-start -->
```tpl ```tpl
{{</* include file="/static/_includes/example.md.part" */>}} {{</* include file="/static/_includes/example.md.part" */>}}
``` ```
<!-- prettier-ignore-end -->
<!-- prettier-ignore-start --> <!-- prettier-ignore-start -->
<!-- spellchecker-disable --> <!-- spellchecker-disable -->
@ -52,9 +58,11 @@ If you include markdown files that should not get a menu entry, place them outsi
This method can be used to include source code files and keep them automatically up to date. This method can be used to include source code files and keep them automatically up to date.
<!-- prettier-ignore-start -->
```tpl ```tpl
{{</* include file="config.yaml" language="yaml" options="linenos=table,hl_lines=5-6,linenostart=100" */>}} {{</* include file="config.yaml" language="yaml" options="linenos=table,hl_lines=5-6,linenostart=100" */>}}
``` ```
<!-- prettier-ignore-end -->
**Code Include:** **Code Include:**
@ -70,9 +78,11 @@ This method can be used to include source code files and keep them automatically
HTML content will be filtered by the `safeHTML` filter and added to the rendered page output. HTML content will be filtered by the `safeHTML` filter and added to the rendered page output.
<!-- prettier-ignore-start -->
```tpl ```tpl
{{</* include file="/static/_includes/example.html.part" */>}} {{</* include file="/static/_includes/example.html.part" */>}}
``` ```
<!-- prettier-ignore-end -->
{{< include file="/static/_includes/example.html.part" type="html" >}} {{< include file="/static/_includes/example.html.part" type="html" >}}

View File

@ -1,39 +1,39 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="{{ .Site.Language.Lang }}" class="color-toggle-hidden"> <html lang="{{ .Site.Language.Lang }}" class="color-toggle-hidden">
<head>
<head>
{{ partial "head/meta" . }} {{ partial "head/meta" . }}
<title>Lost? Don't worry</title> <title>Lost? Don't worry</title>
{{ partial "head/favicons" . }} {{ partial "head/favicons" . }}
{{ partial "head/others" . }} {{ partial "head/others" . }}
</head> </head>
<body> <body>
{{ partial "svg-sprites" . }} {{ partial "svg-sprites" . }}
<div class="wrapper"> <div class="wrapper">
{{ partial "site-header" . }} {{ partial "site-header" . }}
<main class="gblog-error flex-even">
<div class="flex align-center justify-center"> <main class="gblog-error flex-even">
<div class="gblog-error__icon"> <div class="flex align-center justify-center">
<svg class="icon gblog_cloud_off"><use xlink:href="#gblog_cloud_off"></use></svg> <div class="gblog-error__icon">
</div> <svg class="icon gblog_cloud_off"><use xlink:href="#gblog_cloud_off"></use></svg>
<div class="gblog-error__message"> </div>
<div class="gblog-error__line gblog-error__title">Lost?</div> <div class="gblog-error__message">
<div class="gblog-error__line gblog-error__code">Error 404</div> <div class="gblog-error__line gblog-error__title">Lost?</div>
<div class="gblog-error__line gblog-error__help"> <div class="gblog-error__line gblog-error__code">Error 404</div>
Seems like what you are looking for can't be found. Don't worry we can <div class="gblog-error__line gblog-error__help">
bring you back to the <a class="gblog-error__link" href="{{ .Site.BaseURL }}">homepage</a>. Seems like what you are looking for can't be found. Don't worry we can bring you back
</div> to the <a class="gblog-error__link" href="{{ .Site.BaseURL }}">homepage</a>.
</div>
</div> </div>
</main> </div>
</div>
</main>
{{ partial "site-footer" . }} {{ partial "site-footer" . }}
</div> </div>
</body> </body>
</html> </html>

View File

@ -1,5 +1,7 @@
{{- $showAnchor := (and (default true .Page.Params.GeekblogAnchor) (default true .Page.Site.Params.GeekblogAnchor)) -}} {{- $showAnchor := (and (default true .Page.Params.GeekblogAnchor) (default true .Page.Site.Params.GeekblogAnchor)) -}}
<!-- prettier-ignore-start -->
{{- if $showAnchor -}} {{- if $showAnchor -}}
<div class="gblog-post__anchorwrap"> <div class="gblog-post__anchorwrap">
<h{{ .Level }} id="{{ .Anchor | safeURL }}"> <h{{ .Level }} id="{{ .Anchor | safeURL }}">
@ -16,3 +18,4 @@
</h{{ .Level }}> </h{{ .Level }}>
</div> </div>
{{- end -}} {{- end -}}
<!-- prettier-ignore-end -->

View File

@ -1,2 +1,6 @@
<img src="{{ .Destination | safeURL }}" alt="{{ .Text }}" {{ with .Title}} title="{{ . }}"{{ end }} /> <img
src="{{ .Destination | safeURL }}"
alt="{{ .Text }}"
{{ with .Title }}title="{{ . }}"{{ end }}
/>
{{- /* Drop trailing newlines */ -}} {{- /* Drop trailing newlines */ -}}

View File

@ -1,3 +1,8 @@
{{- $raw := or (hasPrefix .Text "<img") (hasPrefix .Text "<figure") -}} {{- $raw := or (hasPrefix .Text "<img") (hasPrefix .Text "<figure") -}}
<a class="gblog-markdown__link{{ if $raw }}--raw{{ end }}" href="{{ .Destination | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}>{{ .Text | safeHTML }}</a> <a
class="gblog-markdown__link{{ if $raw }}--raw{{ end }}"
href="{{ .Destination | safeURL }}"
{{ with .Title }}title="{{ . }}"{{ end }}
>{{ .Text | safeHTML }}</a
>
{{- /* Drop trailing newlines */ -}} {{- /* Drop trailing newlines */ -}}

View File

@ -1,9 +1,15 @@
<!DOCTYPE html> <!DOCTYPE html>
<html itemscope itemtype="http://schema.org/WebPage" lang="{{ .Site.Language.Lang }}" class="color-toggle-hidden"> <html
itemscope
<head> itemtype="http://schema.org/WebPage"
lang="{{ .Site.Language.Lang }}"
class="color-toggle-hidden"
>
<head>
{{ partial "head/meta" . }} {{ partial "head/meta" . }}
<title>{{ if not (eq .Kind "home") }}{{ partial "title" . }} | {{ end }}{{ .Site.Title }}</title> <title>
{{ if not (eq .Kind "home") }}{{ partial "title" . }} |{{ end }}{{ .Site.Title }}
</title>
{{ partial "head/favicons" . }} {{ partial "head/favicons" . }}
{{ partial "head/rel-me" . }} {{ partial "head/rel-me" . }}
@ -11,19 +17,23 @@
{{ partial "head/others" . }} {{ partial "head/others" . }}
{{ partial "head/schema.html" . }} {{ partial "head/schema.html" . }}
{{ partial "head/custom" . }} {{ partial "head/custom" . }}
</head> </head>
<body> <body>
{{ partial "svg-sprites" . }} {{ partial "svg-sprites" . }}
<div class="wrapper {{ if default false .Site.Params.GeekblogDarkModeDim }}dark-mode-dim{{ end }}">
{{ partial "site-header" . }}
<main class="gblog-page container"> <div
{{ template "main" . }} class="wrapper {{ if default false .Site.Params.GeekblogDarkModeDim }}dark-mode-dim{{ end }}"
</main> >
{{ partial "site-header" . }}
{{ partial "site-footer" . }}
<main class="gblog-page container">
{{ template "main" . }}
</main>
{{ partial "site-footer" . }}
</div> </div>
</body> </body>
</html> </html>

View File

@ -1,29 +1,34 @@
{{ define "main" }} {{ define "main" }}
{{ $pages := where .RegularPages "Type" "in" .Site.Params.mainSections }} {{ $pages := where .RegularPages "Type" "in" .Site.Params.mainSections }}
{{ if (eq .Kind "home") }} {{ if (eq .Kind "home") }}
{{ $pages = where .Site.RegularPages "Type" "in" .Site.Params.mainSections }} {{ $pages = where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
{{ end }} {{ end }}
{{ $paginator := .Paginate $pages }} {{ $paginator := .Paginate $pages }}
{{ range $paginator.Pages }} {{ range $paginator.Pages }}
<article class="gblog-post"> <article class="gblog-post">
<header class="gblog-post__header"> <header class="gblog-post__header">
<h1><a href="{{ .RelPermalink }}">{{ partial "title" . }}</a></h1> <h1><a href="{{ .RelPermalink }}">{{ partial "title" . }}</a></h1>
</header> </header>
<section class="gblog-markdown"> <section class="gblog-markdown">
{{ .Summary }} {{ .Summary }}
</section> </section>
<div class="gblog-post__readmore"> <div class="gblog-post__readmore">
{{ if .Truncated }} {{ if .Truncated }}
<a class="flex-inline align-center fake-link" title="Read full post" href="{{ .RelPermalink }}">Read full post<i class="gblog-icon">gblog_arrow_right</i></a> <a
{{ end }} class="flex-inline align-center fake-link"
</div> title="Read full post"
href="{{ .RelPermalink }}"
>Read full post<i class="gblog-icon">gblog_arrow_right</i></a
>
{{ end }}
</div>
<footer class="gblog-post__footer"> <footer class="gblog-post__footer">
{{ partial "metadata.html" . }} {{ partial "metadata.html" . }}
</footer> </footer>
</article> </article>
{{ end }} {{ end }}
{{ partial "pagination.html" . }} {{ partial "pagination.html" . }}
{{ end }} {{ end }}

View File

@ -1,31 +1,33 @@
{{ define "main" }} {{ define "main" }}
<article class="gblog-post"> <article class="gblog-post">
<header class="gblog-post__header"> <header class="gblog-post__header">
{{ $source := ($.Resources.ByType "image").GetMatch "{*feature*,*cover*,*thumbnail*}" }} {{ $source := ($.Resources.ByType "image").GetMatch "{*feature*,*cover*,*thumbnail*}" }}
{{ with $source }} {{ with $source }}
<div class="gblog-post__feature"> <div class="gblog-post__feature">
<picture> <picture>
{{ $featured := .Fill (printf "910x280 %s" (default "Smart" .Params.anchor)) }} {{ $featured := .Fill (printf "910x280 %s" (default "Smart" .Params.anchor)) }}
<source srcset="{{ $featured.Permalink }}"> <source srcset="{{ $featured.Permalink }}" />
<img src="{{ $featured.Permalink }}" alt="{{ default $.Title .Params.description }}" > <img src="{{ $featured.Permalink }}" alt="{{ default $.Title .Params.description }}" />
</picture> </picture>
{{ with $source.Params.credits }} {{ with $source.Params.credits }}
<span>Credits: {{ . | $.Page.RenderString | safeHTML }}</span> <span>Credits: {{ . | $.Page.RenderString | safeHTML }}</span>
{{ end }} {{ end }}
</div>
{{ end }}
<h1>{{ partial "title" . }}</h1>
</header>
{{ if or (eq .Type (default "posts" .Site.Params.GeekblogContentSection)) (eq .Type "post") }}
<div class="gblog-post__meta">
{{ partial "metadata.html" . }}
</div> </div>
{{ end }} {{ end }}
<section class="gblog-markdown">
{{ partial "content" . }} <h1>{{ partial "title" . }}</h1>
</section> </header>
</article>
{{ if or (eq .Type (default "posts" .Site.Params.GeekblogContentSection)) (eq .Type "post") }}
<div class="gblog-post__meta">
{{ partial "metadata.html" . }}
</div>
{{ end }}
<section class="gblog-markdown">
{{ partial "content" . }}
</section>
</article>
{{ end }} {{ end }}

View File

@ -1 +1 @@
<!-- You can add custom elements to the page header here. --> <!-- You can add custom elements to the page header here. -->

View File

@ -1,4 +1,19 @@
<link rel="icon" type="image/svg+xml" href="{{ "favicon/favicon.svg" | relURL }}"> <link rel="icon" type="image/svg+xml" href="{{ "favicon/favicon.svg" | relURL }}" />
<link rel="icon" type="image/png" sizes="48x48" href="{{ "favicon/favicon-32x32.png" | relURL }}"> <link
<link rel="icon" type="image/png" sizes="32x32" href="{{ "favicon/favicon-32x32.png" | relURL }}"> rel="icon"
<link rel="icon" type="image/png" sizes="16x16" href="{{ "favicon/favicon-16x16.png" | relURL }}"> type="image/png"
sizes="48x48"
href="{{ "favicon/favicon-32x32.png" | relURL }}"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="{{ "favicon/favicon-32x32.png" | relURL }}"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="{{ "favicon/favicon-16x16.png" | relURL }}"
/>

View File

@ -1,26 +1,26 @@
<meta charset="UTF-8"> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
{{ $description := default (default .Site.Title .Site.Params.description) (default .Summary .Description) }} {{ $description := default (default .Site.Title .Site.Params.description) (default .Summary .Description) }}
{{ $keywords := default .Site.Params.Keywords .Keywords }} {{ $keywords := default .Site.Params.Keywords .Keywords }}
{{ $authors := default (slice .Site.Params.GeekblogAuthor) .Params.authors }} {{ $authors := default (slice .Site.Params.GeekblogAuthor) .Params.authors }}
{{ with $description }} {{ with $description }}
<meta name="description" content="{{ . }}"> <meta name="description" content="{{ . }}" />
{{ end }} {{ end }}
{{ with $keywords }} {{ with $keywords }}
<meta name="keywords" content="{{ delimit . "," }}"> <meta name="keywords" content="{{ delimit . "," }}" />
{{ end }} {{ end }}
{{ with $authors }} {{ with $authors }}
{{ $list := slice }} {{ $list := slice }}
{{ range sort . }} {{ range sort . }}
{{ with . }} {{ with . }}
{{ $author := index $.Site.Data.authors . }} {{ $author := index $.Site.Data.authors . }}
{{ $list = $list | append $author.name }} {{ $list = $list | append $author.name }}
{{ end }}
{{ end }} {{ end }}
{{ end }}
{{ with $list }} {{ with $list }}
<meta name="author" content="{{ delimit . "," }}"> <meta name="author" content="{{ delimit . "," }}" />
{{ end }} {{ end }}
{{ end }} {{ end }}

View File

@ -1,27 +1,77 @@
<script src="{{ index (index .Site.Data.assets "bundle.js") "src" | relURL }}"></script> <script src="{{ index (index .Site.Data.assets "bundle.js") "src" | relURL }}"></script>
<link rel="preload" as="font" href="{{ "fonts/Metropolis.woff2" | relURL }}" type="font/woff2" crossorigin="anonymous"> <link
<link rel="preload" as="font" href="{{ "fonts/LiberationSans.woff2" | relURL }}" type="font/woff2" crossorigin="anonymous"> rel="preload"
<link rel="preload" as="font" href="{{ "fonts/GeekblogIcons.woff2" | relURL }}" type="font/woff2" crossorigin="anonymous"> as="font"
href="{{ "fonts/Metropolis.woff2" | relURL }}"
type="font/woff2"
crossorigin="anonymous"
/>
<link
rel="preload"
as="font"
href="{{ "fonts/LiberationSans.woff2" | relURL }}"
type="font/woff2"
crossorigin="anonymous"
/>
<link
rel="preload"
as="font"
href="{{ "fonts/GeekblogIcons.woff2" | relURL }}"
type="font/woff2"
crossorigin="anonymous"
/>
<link rel="preload" href="{{ index (index .Site.Data.assets "main.scss") "src" | relURL }}" as="style"> <link
<link rel="stylesheet" href="{{ index (index .Site.Data.assets "main.scss") "src" | relURL }}" media="all"> rel="preload"
href="{{ index (index .Site.Data.assets "main.scss") "src" | relURL }}"
as="style"
/>
<link
rel="stylesheet"
href="{{ index (index .Site.Data.assets "main.scss") "src" | relURL }}"
media="all"
/>
<link rel="preload" href="{{ index (index .Site.Data.assets "mobile.scss") "src" | relURL }}" as="style"> <link
<link rel="stylesheet" href="{{ index (index .Site.Data.assets "mobile.scss") "src" | relURL }}" media="screen and (max-width: 45rem)"> rel="preload"
href="{{ index (index .Site.Data.assets "mobile.scss") "src" | relURL }}"
as="style"
/>
<link
rel="stylesheet"
href="{{ index (index .Site.Data.assets "mobile.scss") "src" | relURL }}"
media="screen and (max-width: 45rem)"
/>
<link rel="preload" href="{{ index (index .Site.Data.assets "print.scss") "src" | relURL }}" as="style"> <link
<link rel="stylesheet" href="{{ index (index .Site.Data.assets "print.scss") "src" | relURL }}" media="print"> rel="preload"
href="{{ index (index .Site.Data.assets "print.scss") "src" | relURL }}"
as="style"
/>
<link
rel="stylesheet"
href="{{ index (index .Site.Data.assets "print.scss") "src" | relURL }}"
media="print"
/>
<link rel="preload" href="{{ index (index .Site.Data.assets "custom.css") "src" | relURL }}" as="style"> <link
<link rel="stylesheet" href="{{ index (index .Site.Data.assets "custom.css") "src" | relURL }}" media="all"> rel="preload"
href="{{ index (index .Site.Data.assets "custom.css") "src" | relURL }}"
as="style"
/>
<link
rel="stylesheet"
href="{{ index (index .Site.Data.assets "custom.css") "src" | relURL }}"
media="all"
/>
{{ with .OutputFormats.Get "atom" }} {{ with .OutputFormats.Get "atom" }}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s">` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} {{ printf `<link rel="%s" type="%s" href="%s" title="%s">` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ end }} {{ end }}
{{ if (default false $.Site.Params.GeekblogOverwriteHTMLBase) }} {{ if (default false $.Site.Params.GeekblogOverwriteHTMLBase) }}
<base href="{{ .Site.BaseURL }}"> <base href="{{ .Site.BaseURL }}" />
{{ end }} {{ end }}
{{ printf "<!-- %s -->" "Made with Geekblog theme https://github.com/thegeeklab/hugo-geekblog" | safeHTML }} {{ printf "<!-- %s -->" "Made with Geekblog theme https://github.com/thegeeklab/hugo-geekblog" | safeHTML }}

View File

@ -1,6 +1,5 @@
{{ if .IsHome -}} {{ if .IsHome -}}
{{ $thumbnail := default (default "brand.svg" .Site.Params.logo) (index (default slice .Site.Params.images) 0) | absURL }} {{ $thumbnail := default (default "brand.svg" .Site.Params.logo) (index (default slice .Site.Params.images) 0) | absURL }}<script type="application/ld+json">
<script type="application/ld+json">
{ {
"@context": "http://schema.org", "@context": "http://schema.org",
"@type": "WebSite", "@type": "WebSite",

View File

@ -1,35 +1,52 @@
{{ $current := .current }} {{ $current := .current }}
{{ template "menu-file" dict "sect" .source "current" $current "site" $current.Site "target" .target }} {{ template "menu-file" dict "sect" .source "current" $current "site" $current.Site "target" .target }}
<!-- template --> <!-- template -->
{{ define "menu-file" }} {{ define "menu-file" }}
{{ $current := .current }} {{ $current := .current }}
{{ $site := .site }} {{ $site := .site }}
{{ $target := .target }} {{ $target := .target }}
{{ range sort (default (seq 0) .sect) "weight" }} {{ range sort (default (seq 0) .sect) "weight" }}
{{ if isset . "ref" }} {{ if isset . "ref" }}
{{ $this := $site.GetPage .ref }} {{ $this := $site.GetPage .ref }}
{{ $isCurrent := eq $current $this }} {{ $isCurrent := eq $current $this }}
{{ $icon := default false .icon }} {{ $icon := default false .icon }}
{{ if eq $target "footer" }} {{ if eq $target "footer" }}
<span class="gblog-footer__item gblog-footer__item--row"> <span class="gblog-footer__item gblog-footer__item--row">
{{ if $icon }}<svg class="icon {{ .icon }}"><use xlink:href="#{{ .icon }}"></use></svg>{{ end }} {{ if $icon }}
<a href="{{ if .external }}{{ .ref }}{{ else }}{{ relref $current .ref }}{{ end }}" <svg class="icon {{ .icon }}"><use xlink:href="#{{ .icon }}"></use></svg>
class="gblog-footer__link"> {{ end }}
{{ .name }} <a
</a> href="{{ if .external }}
{{ .ref }}
{{ else }}
{{ relref $current .ref }}
{{ end }}"
class="gblog-footer__link"
>
{{ .name }}
</a>
</span> </span>
{{ else if eq $target "header" }} {{ else if eq $target "header" }}
<li> <li>
<a href="{{ if .external }}{{ .ref }}{{ else }}{{ relref $current .ref }}{{ end }}" <a
class="gblog-nav__entry {{ if $isCurrent }}is-active{{ end }}"> href="{{ if .external }}
{{ if $icon }}<svg class="icon {{ .icon }}"><use xlink:href="#{{ .icon }}"></use></svg>{{ end }} {{ .ref }}
{{ .name }} {{ else }}
</a> {{ relref $current .ref }}
{{ end }}"
class="gblog-nav__entry {{ if $isCurrent }}is-active{{ end }}"
>
{{ if $icon }}
<svg class="icon {{ .icon }}"><use xlink:href="#{{ .icon }}"></use></svg>
{{ end }}
{{ .name }}
</a>
</li> </li>
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}

View File

@ -1,71 +1,78 @@
<span class="no-wrap"> <span class="no-wrap">
<svg class="icon gblog_date"><use xlink:href="#gblog_date"></use></svg> <svg class="icon gblog_date"><use xlink:href="#gblog_date"></use></svg>
<span class="gblog-post__tag"> <span class="gblog-post__tag">
<time datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}"> <time datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}">
{{ if .Lastmod.After (.Date.AddDate 0 0 1) }} {{ if .Lastmod.After (.Date.AddDate 0 0 1) }}
Updated on Updated on
{{ end }} {{ end }}
{{ .Lastmod.Format "Jan 2, 2006" }} {{ .Lastmod.Format "Jan 2, 2006" }}
</time> </time>
</span> </span>
</span> </span>
<span class="no-wrap"> <span class="no-wrap">
<svg class="icon gblog_timer"><use xlink:href="#gblog_timer"></use></svg> <svg class="icon gblog_timer"><use xlink:href="#gblog_timer"></use></svg>
<span class="gblog-post__tag">{{ .ReadingTime }} min read</span> <span class="gblog-post__tag">{{ .ReadingTime }} min read</span>
</span> </span>
{{ if eq .Params.weight 1 }} {{ if eq .Params.weight 1 }}
<span class="no-wrap"> <span class="no-wrap">
<svg class="icon gblog_pin"><use xlink:href="#gblog_pin"></use></svg> <svg class="icon gblog_pin"><use xlink:href="#gblog_pin"></use></svg>
<span class="gblog-post__tag">Pinned</span> <span class="gblog-post__tag">Pinned</span>
</span> </span>
{{ end }} {{ end }}
{{ $ac := 0 }} {{ $ac := 0 }}
{{ with .Params.authors }} {{ with .Params.authors }}
{{ range sort . }} {{ range sort . }}
{{ $author := index $.Site.Data.authors . }} {{ $author := index $.Site.Data.authors . }}
{{ with $.Site.GetPage (printf "/authors/%s" . | urlize) }} {{ with $.Site.GetPage (printf "/authors/%s" . | urlize) }}
{{ if eq $ac 0 }} {{ if eq $ac 0 }}
<span class="no-wrap"> <span class="no-wrap">
<svg class="icon gblog_person"><use xlink:href="#gblog_person"></use></svg> <svg class="icon gblog_person"><use xlink:href="#gblog_person"></use></svg>
{{ template "post-author" dict "name" $author.name "page" . }} {{ template "post-author" dict "name" $author.name "page" . }}
</span> </span>
{{ else }} {{ else }}
{{ template "post-author" dict "name" $author.name "page" . }} {{ template "post-author" dict "name" $author.name "page" . }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ $ac = (add $ac 1) }} {{ $ac = (add $ac 1) }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ $tc := 0 }} {{ $tc := 0 }}
{{ with .Params.tags }} {{ with .Params.tags }}
{{ range sort . }} {{ range sort . }}
{{ $name := . }} {{ $name := . }}
{{ with $.Site.GetPage (printf "/tags/%s" $name | urlize) }} {{ with $.Site.GetPage (printf "/tags/%s" $name | urlize) }}
{{ if eq $tc 0 }} {{ if eq $tc 0 }}
<span class="no-wrap"> <span class="no-wrap">
<svg class="icon gblog_bookmarks"><use xlink:href="#gblog_bookmarks"></use></svg> <svg class="icon gblog_bookmarks"><use xlink:href="#gblog_bookmarks"></use></svg>
{{ template "post-tag" dict "name" $name "page" . }} {{ template "post-tag" dict "name" $name "page" . }}
</span> </span>
{{ else }} {{ else }}
{{ template "post-tag" dict "name" $name "page" . }} {{ template "post-tag" dict "name" $name "page" . }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ $tc = (add $tc 1) }} {{ $tc = (add $tc 1) }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ define "post-tag" }} {{ define "post-tag" }}
<span class="gblog-post__tag gblog-button"> <span class="gblog-post__tag gblog-button">
<a class="gblog-button__link" href="{{ .page.RelPermalink }}" title="All posts tagged with '{{ .name }}'">{{ .name }}</a> <a
</span> class="gblog-button__link"
href="{{ .page.RelPermalink }}"
title="All posts tagged with '{{ .name }}'"
>{{ .name }}</a
>
</span>
{{ end }} {{ end }}
{{ define "post-author" }} {{ define "post-author" }}
<span class="gblog-post__tag gblog-button"> <span class="gblog-post__tag gblog-button">
<a class="gblog-button__link" href="{{ .page.RelPermalink }}" title="All posts of this author">{{ .name }}</a> <a class="gblog-button__link" href="{{ .page.RelPermalink }}" title="All posts of this author"
</span> >{{ .name }}</a
>
</span>
{{ end }} {{ end }}

View File

@ -1,45 +1,75 @@
<meta property="og:title" content="{{ .Title }}" /> <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: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:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
<meta property="og:url" content="{{ .Permalink }}" /> <meta property="og:url" content="{{ .Permalink }}" />
{{- with $.Params.images -}} {{- with $.Params.images -}}
{{- range first 6 . }}<meta property="og:image" content="{{ . | absURL }}" />{{ end -}} {{- range first 6 . }}<meta property="og:image" content="{{ . | absURL }}" />{{ end -}}
{{- else -}} {{- else -}}
{{- $images := $.Resources.ByType "image" -}} {{- $images := $.Resources.ByType "image" -}}
{{- $featured := $images.GetMatch "*feature*" -}} {{- $featured := $images.GetMatch "*feature*" -}}
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
{{- with $featured -}} {{- with $featured -}}
<meta property="og:image" content="{{ $featured.Permalink }}"/> <meta property="og:image" content="{{ $featured.Permalink }}" />
{{- else -}} {{- else -}}
{{- with $.Site.Params.images }}<meta property="og:image" content="{{ index . 0 | absURL }}"/>{{ end -}} {{- with $.Site.Params.images }}
{{- end -}} <meta property="og:image" content="{{ index . 0 | absURL }}" />
{{ end -}}
{{- end -}}
{{- end -}} {{- end -}}
{{- if .IsPage }} {{- if .IsPage }}
{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} {{- $iso8601 := "2006-01-02T15:04:05-07:00" -}}
<meta property="article:section" content="{{ .Section }}" /> <meta property="article:section" content="{{ .Section }}" />
{{ with .PublishDate }}<meta property="article:published_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }} {{ with .PublishDate }}
{{ with .Lastmod }}<meta property="article:modified_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }} <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 -}} {{- end -}}
{{- with .Params.audio }}<meta property="og:audio" content="{{ . }}" />{{ end }} {{- with .Params.audio }}<meta property="og:audio" content="{{ . }}" />{{ end }}
{{- with .Params.locale }}<meta property="og:locale" content="{{ . }}" />{{ end }} {{- with .Params.locale }}<meta property="og:locale" content="{{ . }}" />{{ end }}
{{- with .Site.Params.title }}<meta property="og:site_name" content="{{ . }}" />{{ end }} {{- with .Site.Params.title }}<meta property="og:site_name" content="{{ . }}" />{{ end }}
{{- with .Params.videos }}{{- range . }} {{- with .Params.videos }}
<meta property="og:video" content="{{ . | absURL }}" /> {{- range . }}
{{ end }}{{ end }} <meta property="og:video" content="{{ . | absURL }}" />
{{ end }}
{{ end }}
{{- /* If it is part of a series, link to related articles */}} {{- /* If it is part of a series, link to related articles */}}
{{- if .Site.Taxonomies.series }} {{- if .Site.Taxonomies.series }}
{{- $permalink := .Permalink }} {{- $permalink := .Permalink }}
{{- $siteSeries := .Site.Taxonomies.series }} {{- $siteSeries := .Site.Taxonomies.series }}
{{ with .Params.series }}{{- range $name := . }} {{ with .Params.series }}
{{- $series := index $siteSeries ($name | urlize) }} {{- range $name := . }}
{{- range $page := first 6 $series.Pages }} {{- $series := index $siteSeries ($name | urlize) }}
{{- if ne $page.Permalink $permalink }}<meta property="og:see_also" content="{{ $page.Permalink }}" />{{ end }} {{- range $page := first 6 $series.Pages }}
{{- end }} {{- if ne $page.Permalink $permalink }}
{{ end }}{{ end }} <meta property="og:see_also" content="{{ $page.Permalink }}" />
{{ end }}
{{- end }}
{{ end }}
{{ end }}
{{- end }} {{- end }}
{{- /* Facebook Page Admin ID for Domain Insights */}} {{- /* Facebook Page Admin ID for Domain Insights */}}

View File

@ -1,25 +1,35 @@
{{- with $.Params.images -}} {{- with $.Params.images -}}
<meta name="twitter:card" content="summary_large_image"/> <meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:image" content="{{ index . 0 | absURL }}"/> <meta name="twitter:image" content="{{ index . 0 | absURL }}" />
{{ else -}} {{ else -}}
{{- $images := $.Resources.ByType "image" -}} {{- $images := $.Resources.ByType "image" -}}
{{- $featured := $images.GetMatch "*feature*" -}} {{- $featured := $images.GetMatch "*feature*" -}}
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
{{- with $featured -}} {{- with $featured -}}
<meta name="twitter:card" content="summary_large_image"/> <meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:image" content="{{ $featured.Permalink }}"/> <meta name="twitter:image" content="{{ $featured.Permalink }}" />
{{- else -}} {{- else -}}
{{- with $.Site.Params.images -}} {{- with $.Site.Params.images -}}
<meta name="twitter:card" content="summary_large_image"/> <meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:image" content="{{ index . 0 | absURL }}"/> <meta name="twitter:image" content="{{ index . 0 | absURL }}" />
{{ else -}} {{ else -}}
<meta name="twitter:card" content="summary"/> <meta name="twitter:card" content="summary" />
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- end }} {{- end }}
<meta name="twitter:title" content="{{ .Title }}"/> <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
name="twitter:description"
content="{{ with .Description }}
{{ . }}
{{ else }}
{{ if .IsPage }}
{{ .Summary }}
{{ else }}
{{ with .Site.Params.description }}{{ . }}{{ end }}
{{ end }}
{{ end -}}"
/>
{{ with .Site.Social.twitter -}} {{ with .Site.Social.twitter -}}
<meta name="twitter:site" content="@{{ . }}"/> <meta name="twitter:site" content="@{{ . }}" />
{{ end -}} {{ end -}}

View File

@ -1,15 +1,20 @@
{{ $pag := $.Paginator }} {{ $pag := $.Paginator }}
<nav class="gblog-paging flex flex-even align-center" role="navigation"> <nav class="gblog-paging flex flex-even align-center" role="navigation">
<div class="gblog-paging__item gblog-paging__item--prev"> <div class="gblog-paging__item gblog-paging__item--prev">
{{ if $pag.HasPrev }} {{ if $pag.HasPrev }}
<a class="flex-inline align-center fake-link no-wrap" href="{{ $pag.Prev.URL }}"><i class="gblog-icon">gblog_keyboard_arrow_left</i>PREV</a> <a class="flex-inline align-center fake-link no-wrap" href="{{ $pag.Prev.URL }}"
><i class="gblog-icon">gblog_keyboard_arrow_left</i>PREV</a
>
{{ end }} {{ end }}
</div> </div>
<div class="gblog-paging__state">Page {{ $pag.PageNumber }} of {{ $pag.TotalPages }}</div> <div class="gblog-paging__state">Page {{ $pag.PageNumber }} of {{ $pag.TotalPages }}</div>
<div class="gblog-paging__item gblog-paging__item--next"> <div class="gblog-paging__item gblog-paging__item--next">
{{ if $pag.HasNext }} {{ if $pag.HasNext }}
<a class="flex-inline align-center fake-link no-wrap" href="{{ $pag.Next.URL }}">NEXT<i class="gblog-icon">gblog_keyboard_arrow_right</i></a> <a class="flex-inline align-center fake-link no-wrap" href="{{ $pag.Next.URL }}"
>NEXT<i class="gblog-icon">gblog_keyboard_arrow_right</i></a
>
{{ end }} {{ end }}
</div> </div>
</nav> </nav>

View File

@ -1,56 +1,60 @@
<footer class="gblog-footer"> <footer class="gblog-footer">
<nav class="container flex"> <nav class="container flex">
<div> <div>
<section class="flex flex-wrap align-center"> <section class="flex flex-wrap align-center">
{{ with (.Site.GetPage "home").OutputFormats.Get "atom" }} {{ with (.Site.GetPage "home").OutputFormats.Get "atom" }}
<span class="gblog-footer__item gblog-footer__item--row"> <span class="gblog-footer__item gblog-footer__item--row">
<svg class="icon gblog_rss_feed"><use xlink:href="#gblog_rss_feed"></use></svg> <svg class="icon gblog_rss_feed"><use xlink:href="#gblog_rss_feed"></use></svg>
<a href='{{ .Permalink | relURL }}' class="gblog-footer__link">Atom Feed</a> <a href="{{ .Permalink | relURL }}" class="gblog-footer__link">Atom Feed</a>
</span> </span>
{{ end }}
{{ if .Site.Data.menu.extra.footer }}
{{ partial "menu-extra" (dict "current" . "source" .Site.Data.menu.extra.footer "target" "footer") }}
{{ end }}
{{ with .Site.Params.GeekblogLegalNotice }}
<span class="gblog-footer__item gblog-footer__item--row">
<a href="{{ . | relURL }}" class="gblog-footer__link">Legal Notice</a>
</span>
{{ end }}
{{ with .Site.Params.GeekblogPrivacyPolicy }}
<span class="gblog-footer__item gblog-footer__item--row">
<a href="{{ . | relURL }}" class="gblog-footer__link">Privacy Policy</a>
</span>
{{ end }}
</section>
<section class="flex flex-wrap align-center">
<span class="gblog-footer__item">
Built with <a href="https://gohugo.io/" class="gblog-footer__link">Hugo</a> and
<svg class="icon gblog_heart"><use xlink:href="#gblog_heart"></use></svg>
</span>
</section>
{{ with .Site.Params.GeekblogHostedOn }}
<section class="flex flex-wrap align-center">
<span class="gblog-footer__item">
Hosted on <a href="{{ .link }}" class="gblog-footer__link">{{ .name }}</a>
</span>
</section>
{{ end }}
{{ with .Site.Params.GeekblogContentLicense }}
<section class="flex flex-wrap align-center">
<span class="gblog-footer__item">
Content licensed under <a href="{{ .link }}" class="gblog-footer__link no-wrap">{{ .name }}</a>
</span>
</section>
{{ end }}
</div>
{{ if (default true .Site.Params.GeekblogBackToTop) }}
<div class="flex flex-25 justify-end">
<span class="gblog-footer__item text-right">
<a class="gblog-footer__link fake-link" href="#" aria-label="Back to top">
<svg class="icon gblog_keyborad_arrow_up"><use xlink:href="#gblog_keyborad_arrow_up"></use></svg> <span class="hidden-mobile">Back to top</span>
</a>
</span>
</div>
{{ end }} {{ end }}
</nav> {{ if .Site.Data.menu.extra.footer }}
{{ partial "menu-extra" (dict "current" . "source" .Site.Data.menu.extra.footer "target" "footer") }}
{{ end }}
{{ with .Site.Params.GeekblogLegalNotice }}
<span class="gblog-footer__item gblog-footer__item--row">
<a href="{{ . | relURL }}" class="gblog-footer__link">Legal Notice</a>
</span>
{{ end }}
{{ with .Site.Params.GeekblogPrivacyPolicy }}
<span class="gblog-footer__item gblog-footer__item--row">
<a href="{{ . | relURL }}" class="gblog-footer__link">Privacy Policy</a>
</span>
{{ end }}
</section>
<section class="flex flex-wrap align-center">
<span class="gblog-footer__item">
Built with <a href="https://gohugo.io/" class="gblog-footer__link">Hugo</a> and
<svg class="icon gblog_heart"><use xlink:href="#gblog_heart"></use></svg>
</span>
</section>
{{ with .Site.Params.GeekblogHostedOn }}
<section class="flex flex-wrap align-center">
<span class="gblog-footer__item">
Hosted on <a href="{{ .link }}" class="gblog-footer__link">{{ .name }}</a>
</span>
</section>
{{ end }}
{{ with .Site.Params.GeekblogContentLicense }}
<section class="flex flex-wrap align-center">
<span class="gblog-footer__item">
Content licensed under
<a href="{{ .link }}" class="gblog-footer__link no-wrap">{{ .name }}</a>
</span>
</section>
{{ end }}
</div>
{{ if (default true .Site.Params.GeekblogBackToTop) }}
<div class="flex flex-25 justify-end">
<span class="gblog-footer__item text-right">
<a class="gblog-footer__link fake-link" href="#" aria-label="Back to top">
<svg class="icon gblog_keyborad_arrow_up">
<use xlink:href="#gblog_keyborad_arrow_up"></use>
</svg>
<span class="hidden-mobile">Back to top</span>
</a>
</span>
</div>
{{ end }}
</nav>
</footer> </footer>

View File

@ -1,57 +1,65 @@
<header class="gblog-header"> <header class="gblog-header">
<div class="container flex flex-wrap"> <div class="container flex flex-wrap">
<div class="gblog-header__col-1 flex justify-start hidden-mobile"></div> <div class="gblog-header__col-1 flex justify-start hidden-mobile"></div>
<div class="gblog-header__col-2 flex align-center justify-center "> <div class="gblog-header__col-2 flex align-center justify-center ">
<a class="gblog-header__link" rel="me" href="{{ .Site.BaseURL }}"> <a class="gblog-header__link" rel="me" href="{{ .Site.BaseURL }}">
<span class="gblog-brand flex align-center justify-center"> <span class="gblog-brand flex align-center justify-center">
<img class="gblog-brand__img" src="{{ (default "brand.svg" .Site.Params.logo) | relURL }}" alt=""> <img
<span class="gblog-brand__title">{{ .Site.Title }}</span> class="gblog-brand__img"
</span> src="{{ (default "brand.svg" .Site.Params.logo) | relURL }}"
{{ with .Site.Params.subtitle }} alt=""
<span class="gblog-brand__subtitle flex align-center justify-center">{{ . }}</span> />
{{ end }} <span class="gblog-brand__title">{{ .Site.Title }}</span>
</a> </span>
</div> {{ with .Site.Params.subtitle }}
<div class="gblog-header__col-3 flex justify-end"> <span class="gblog-brand__subtitle flex align-center justify-center">{{ . }}</span>
<span id="gblog-dark-mode"> {{ end }}
<svg class="icon gblog_brightness_dark"> </a>
<title>{{ i18n "button_toggle_dark" }}</title>
<use xlink:href="#gblog_brightness_dark"></use>
</svg>
<svg class="icon gblog_brightness_light">
<title>{{ i18n "button_toggle_dark" }}</title>
<use xlink:href="#gblog_brightness_light"></use>
</svg>
<svg class="icon gblog_brightness_auto">
<title>{{ i18n "button_toggle_dark" }}</title>
<use xlink:href="#gblog_brightness_auto"></use>
</svg>
</span>
</div>
</div> </div>
<div class="gblog-header__col-3 flex justify-end">
<span id="gblog-dark-mode">
<svg class="icon gblog_brightness_dark">
<title>{{ i18n "button_toggle_dark" }}</title>
<use xlink:href="#gblog_brightness_dark"></use>
</svg>
<svg class="icon gblog_brightness_light">
<title>{{ i18n "button_toggle_dark" }}</title>
<use xlink:href="#gblog_brightness_light"></use>
</svg>
<svg class="icon gblog_brightness_auto">
<title>{{ i18n "button_toggle_dark" }}</title>
<use xlink:href="#gblog_brightness_auto"></use>
</svg>
</span>
</div>
</div>
</header> </header>
<nav class="gblog-nav"> <nav class="gblog-nav">
<input type="checkbox" id="menu-control" class="hidden"> <input type="checkbox" id="menu-control" class="hidden" />
<div class="gblog-nav__control"> <div class="gblog-nav__control">
<label for="menu-control" class="flex align-center justify-center"> <label for="menu-control" class="flex align-center justify-center">
<svg class="icon gblog_menu"><use xlink:href="#gblog_menu"></use></svg> <svg class="icon gblog_menu"><use xlink:href="#gblog_menu"></use></svg>
<svg class="icon gblog_clear"><use xlink:href="#gblog_clear"></use></svg> <svg class="icon gblog_clear"><use xlink:href="#gblog_clear"></use></svg>
<span>Navigation</span> <span>Navigation</span>
</label> </label>
</div> </div>
<ul class="gblog-nav__list container flex flex-wrap justify-center menu-content"> <ul class="gblog-nav__list container flex flex-wrap justify-center menu-content">
{{ $currentPage := .RelPermalink }} {{ $currentPage := .RelPermalink }}
{{ if default true .Site.Params.GeekblogTagsToMenu }} {{ if default true .Site.Params.GeekblogTagsToMenu }}
{{ range $name, $taxonomy := .Site.Taxonomies.tags }} {{ range $name, $taxonomy := .Site.Taxonomies.tags }}
{{ with $.Site.GetPage (printf "/tags/%s" $name) }} {{ with $.Site.GetPage (printf "/tags/%s" $name) }}
<li> <li>
<a class="gblog-nav__entry {{ if eq $currentPage .RelPermalink }} is-active {{ end }}" href="{{ .RelPermalink }}">{{ .Title }}</a> <a
</li> class="gblog-nav__entry {{ if eq $currentPage .RelPermalink }}is-active{{ end }}"
href="{{ .RelPermalink }}"
>{{ .Title }}</a
>
</li>
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ if .Site.Data.menu.extra.header }} {{ if .Site.Data.menu.extra.header }}
{{ partial "menu-extra" (dict "current" . "source" .Site.Data.menu.extra.header "target" "header") }} {{ partial "menu-extra" (dict "current" . "source" .Site.Data.menu.extra.header "target" "header") }}
{{ end }} {{ end }}
</ul> </ul>
</nav> </nav>

View File

@ -1,4 +1,4 @@
{{ range resources.Match "sprites/*.svg" }} {{ range resources.Match "sprites/*.svg" }}
{{ printf "<!-- geekblog include: %s -->" . | safeHTML }} {{ printf "<!-- geekblog include: %s -->" . | safeHTML }}
{{ .Content | safeHTML }} {{ .Content | safeHTML }}
{{ end }} {{ end }}

View File

@ -1,15 +1,15 @@
{{ $title := "" }} {{ $title := "" }}
{{ if .Title }} {{ if .Title }}
{{ $title = .Title }} {{ $title = .Title }}
{{ else if and .IsSection .File }} {{ else if and .IsSection .File }}
{{ $title = path.Base .File.Dir | humanize | title }} {{ $title = path.Base .File.Dir | humanize | title }}
{{ else if and .IsPage .File }} {{ else if and .IsPage .File }}
{{ $title = .File.BaseFileName | humanize | title }} {{ $title = .File.BaseFileName | humanize | title }}
{{ end }} {{ end }}
{{ if eq .Kind "term" }} {{ if eq .Kind "term" }}
{{ $title = $title | humanize | title }} {{ $title = $title | humanize | title }}
{{ end }} {{ end }}
{{ return $title }} {{ return $title }}

View File

@ -2,7 +2,7 @@
{{ $size := default "regular" (.Get "size" | lower) }} {{ $size := default "regular" (.Get "size" | lower) }}
{{ if not (in (slice "regular" "large") $size) }} {{ if not (in (slice "regular" "large") $size) }}
{{ $size = "regular" }} {{ $size = "regular" }}
{{ end }} {{ end }}
{{ with .Get "href" }} {{ with .Get "href" }}
@ -13,8 +13,9 @@
{{ $ref = relref $ . }} {{ $ref = relref $ . }}
{{ end }} {{ end }}
<span class="gblog-button gblog-button--{{ $size }}{{ with .Get "class" }} {{ . }}{{ end }}">
<a {{ with $ref }} href="{{.}}" {{ end }} class="gblog-button__link"> <span class="gblog-button gblog-button--{{ $size }}{{ with .Get "class" }}{{ . }}{{ end }}">
{{ $.Inner }} <a {{ with $ref }}href="{{ . }}"{{ end }} class="gblog-button__link">
</a> {{ $.Inner }}
</a>
</span> </span>

View File

@ -1,7 +1,7 @@
<div class="gblog-columns flex flex-wrap flex-mobile-column"> <div class="gblog-columns flex flex-wrap flex-mobile-column">
{{ range split .Inner "<--->" }} {{ range split .Inner "<--->" }}
<div class="gblog-columns__content gblog-markdown--nested flex-even"> <div class="gblog-columns__content gblog-markdown--nested flex-even">
{{ . | $.Page.RenderString }} {{ . | $.Page.RenderString }}
</div> </div>
{{ end }} {{ end }}
</div> </div>

View File

@ -1,5 +1,5 @@
{{ $id := .Get 0 }} {{ $id := .Get 0 }}
{{- with $id -}} {{- with $id -}}
<svg class="icon {{ . }}"><use xlink:href="#{{ . }}"></use></svg> <svg class="icon {{ . }}"><use xlink:href="#{{ . }}"></use></svg>
{{- end -}} {{- end -}}

View File

@ -4,35 +4,39 @@
{{ $lazyLoad := default (default true $.Site.Params.GeekblogImageLazyLoading) (.Get "lazy") }} {{ $lazyLoad := default (default true $.Site.Params.GeekblogImageLazyLoading) (.Get "lazy") }}
{{ with $source }} {{ with $source }}
{{ $caption := default .Title $customAlt }} {{ $caption := default .Title $customAlt }}
{{ $tiny := (.Resize "320x").RelPermalink }} {{ $tiny := (.Resize "320x").RelPermalink }}
{{ $small := (.Resize "600x").RelPermalink }} {{ $small := (.Resize "600x").RelPermalink }}
{{ $medium := (.Resize "1200x").RelPermalink }} {{ $medium := (.Resize "1200x").RelPermalink }}
{{ $large := (.Resize "1800x").RelPermalink }} {{ $large := (.Resize "1800x").RelPermalink }}
{{ $size := dict "tiny" $tiny "small" $small "medium" $medium "large" $large }} {{ $size := dict "tiny" $tiny "small" $small "medium" $medium "large" $large }}
<div class="flex justify-center">
<figure class="gblog-post__figure"> <div class="flex justify-center">
<a class="gblog-markdown__link--raw" href="{{ .RelPermalink }}"> <figure class="gblog-post__figure">
<a class="gblog-markdown__link--raw" href="{{ .RelPermalink }}">
<picture> <picture>
<source <source
{{ with $customSize }} {{ with $customSize }}
srcset="{{ index $size $customSize }}" srcset="{{ index $size $customSize }}"
{{ else }} {{ else }}
srcset="{{ $size.small }} 600w, srcset="{{ $size.small }} 600w, {{ $size.medium }} 1200w" sizes="100vw"
{{ $size.medium }} 1200w" {{ end }}
sizes="100vw" />
{{ end }} /> <img
<img {{ if $lazyLoad }}loading="lazy"{{ end }}
{{ if $lazyLoad }}loading="lazy"{{ end }} src="{{ $size.large }}"
src="{{ $size.large }}" alt="{{ $caption }}" /> alt="{{ $caption }}"
/>
</picture> </picture>
</a> </a>
{{ with $caption }} {{ with $caption }}
<figcaption>{{ . }}{{ with $source.Params.credits }} ({{ . | $.Page.RenderString }}){{ end }}</figcaption> <figcaption>
{{ end }} {{ . }}{{ with $source.Params.credits }}({{ . | $.Page.RenderString }}){{ end }}
</figure> </figcaption>
</div> {{ end }}
</figure>
</div>
{{ end }} {{ end }}

View File

@ -4,14 +4,15 @@
{{ $language := .Get "language" }} {{ $language := .Get "language" }}
{{ $options :=.Get "options" }} {{ $options :=.Get "options" }}
<div class="gblog-include"> <div class="gblog-include">
{{- if (.Get "language") -}} {{- if (.Get "language") -}}
{{- highlight ($file | readFile) $language (default "linenos=table" $options) -}} {{- highlight ($file | readFile) $language (default "linenos=table" $options) -}}
{{- else if eq $type "html" -}} {{- else if eq $type "html" -}}
{{- $file | readFile | safeHTML -}} {{- $file | readFile | safeHTML -}}
{{- else if eq $type "page" -}} {{- else if eq $type "page" -}}
{{- with $page }}{{ .Content }}{{ end -}} {{- with $page }}{{ .Content }}{{ end -}}
{{- else -}} {{- else -}}
{{- $file | readFile | $.Page.RenderString -}} {{- $file | readFile | $.Page.RenderString -}}
{{- end -}} {{- end -}}
</div> </div>

View File

@ -1,9 +1,9 @@
{{ if not (.Page.Scratch.Get "mermaid") }} {{ if not (.Page.Scratch.Get "mermaid") }}
<!-- Include mermaid only first time --> <!-- Include mermaid only first time --><script defer src="{{ index (index .Site.Data.assets "mermaid.js") "src" | relURL }}"></script>
<script defer src="{{ index (index .Site.Data.assets "mermaid.js") "src" | relURL }}"></script> {{ .Page.Scratch.Set "mermaid" true }}
{{ .Page.Scratch.Set "mermaid" true }}
{{ end }} {{ end }}
<pre class="gblog-mermaid mermaid{{ with .Get "class" }} {{ . }}{{ end }}">
<pre class="gblog-mermaid mermaid{{ with .Get "class" }}{{ . }}{{ end }}">
{{- .Inner -}} {{- .Inner -}}
</pre> </pre>

View File

@ -9,4 +9,4 @@
{{ .Parent.Scratch.Add $group (dict "Name" $name "Content" .Inner) }} {{ .Parent.Scratch.Add $group (dict "Name" $name "Content" .Inner) }}
{{ else }} {{ else }}
{{ errorf "%q: 'tab' shortcode must be inside 'tabs' shortcode" .Page.Path }} {{ errorf "%q: 'tab' shortcode must be inside 'tabs' shortcode" .Page.Path }}
{{ end}} {{ end }}

View File

@ -2,10 +2,16 @@
{{ $id := .Get 0 }} {{ $id := .Get 0 }}
{{ $group := printf "tabs-%s" $id }} {{ $group := printf "tabs-%s" $id }}
<div class="gblog-tabs"> <div class="gblog-tabs">
{{ range $index, $tab := .Scratch.Get $group }} {{ range $index, $tab := .Scratch.Get $group }}
<input type="radio" class="gblog-tabs__control hidden" name="{{ $group }}" id="{{ printf "%s-%d" $group $index }}" <input
{{ if not $index }}checked="checked" {{ end }} /> type="radio"
class="gblog-tabs__control hidden"
name="{{ $group }}"
id="{{ printf "%s-%d" $group $index }}"
{{ if not $index }}checked="checked"{{ end }}
/>
<label for="{{ printf "%s-%d" $group $index }}" class="gblog-tabs__label"> <label for="{{ printf "%s-%d" $group $index }}" class="gblog-tabs__label">
{{ $tab.Name }} {{ $tab.Name }}
</label> </label>

View File

@ -1,5 +1,8 @@
{{ $tocLevels := default (default 6 .Site.Params.GeekblogToC) .Page.Params.GeekblogToC }} {{ $tocLevels := default (default 6 .Site.Params.GeekblogToC) .Page.Params.GeekblogToC }}
{{ if and $tocLevels .Page.TableOfContents }} {{ if and $tocLevels .Page.TableOfContents }}
<div class="gblog-toc gblog-toc__level--{{$tocLevels}}">{{ .Page.TableOfContents }}<hr></div> <div class="gblog-toc gblog-toc__level--{{ $tocLevels }}">
{{ .Page.TableOfContents }}
<hr />
</div>
{{ end }} {{ end }}