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
search*.js
_normalize.css
list.json.json
.lighthouseci/
themes/
static/js/
src/favicon/
/.lighthouseci/
/themes/
/static/js/
/src/favicon/
LICENSE

View File

@ -14,11 +14,15 @@ Include shortcode can include files of different types. By specifying a language
{{< toc >}}
## Usage
<!-- prettier-ignore-start -->
```tpl
{{</* include file="relative/path/from/hugo/root" language="go" markdown=[false|true] */>}}
```
<!-- prettier-ignore-end -->
Attributes:
### Attributes
| 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.
{{< /hint >}}
<!-- prettier-ignore-start -->
```tpl
{{</* include file="/static/_includes/example.md.part" */>}}
```
<!-- prettier-ignore-end -->
<!-- prettier-ignore-start -->
<!-- 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.
<!-- prettier-ignore-start -->
```tpl
{{</* include file="config.yaml" language="yaml" options="linenos=table,hl_lines=5-6,linenostart=100" */>}}
```
<!-- prettier-ignore-end -->
**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.
<!-- prettier-ignore-start -->
```tpl
{{</* include file="/static/_includes/example.html.part" */>}}
```
<!-- prettier-ignore-end -->
{{< include file="/static/_includes/example.html.part" type="html" >}}

View File

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

View File

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

View File

@ -1,3 +1,8 @@
{{- $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 */ -}}

View File

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

View File

@ -1,29 +1,34 @@
{{ define "main" }}
{{ $pages := where .RegularPages "Type" "in" .Site.Params.mainSections }}
{{ if (eq .Kind "home") }}
{{ $pages = where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
{{ end }}
{{ $pages := where .RegularPages "Type" "in" .Site.Params.mainSections }}
{{ if (eq .Kind "home") }}
{{ $pages = where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
{{ end }}
{{ $paginator := .Paginate $pages }}
{{ range $paginator.Pages }}
{{ $paginator := .Paginate $pages }}
{{ range $paginator.Pages }}
<article class="gblog-post">
<header class="gblog-post__header">
<h1><a href="{{ .RelPermalink }}">{{ partial "title" . }}</a></h1>
</header>
<header class="gblog-post__header">
<h1><a href="{{ .RelPermalink }}">{{ partial "title" . }}</a></h1>
</header>
<section class="gblog-markdown">
{{ .Summary }}
</section>
<div class="gblog-post__readmore">
{{ 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>
{{ end }}
</div>
<section class="gblog-markdown">
{{ .Summary }}
</section>
<div class="gblog-post__readmore">
{{ 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
>
{{ end }}
</div>
<footer class="gblog-post__footer">
{{ partial "metadata.html" . }}
</footer>
<footer class="gblog-post__footer">
{{ partial "metadata.html" . }}
</footer>
</article>
{{ end }}
{{ partial "pagination.html" . }}
{{ end }}
{{ partial "pagination.html" . }}
{{ end }}

View File

@ -1,31 +1,33 @@
{{ define "main" }}
<article class="gblog-post">
<header class="gblog-post__header">
{{ $source := ($.Resources.ByType "image").GetMatch "{*feature*,*cover*,*thumbnail*}" }}
{{ with $source }}
<div class="gblog-post__feature">
<picture>
{{ $featured := .Fill (printf "910x280 %s" (default "Smart" .Params.anchor)) }}
<source srcset="{{ $featured.Permalink }}">
<img src="{{ $featured.Permalink }}" alt="{{ default $.Title .Params.description }}" >
</picture>
{{ with $source.Params.credits }}
<span>Credits: {{ . | $.Page.RenderString | safeHTML }}</span>
{{ 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" . }}
<article class="gblog-post">
<header class="gblog-post__header">
{{ $source := ($.Resources.ByType "image").GetMatch "{*feature*,*cover*,*thumbnail*}" }}
{{ with $source }}
<div class="gblog-post__feature">
<picture>
{{ $featured := .Fill (printf "910x280 %s" (default "Smart" .Params.anchor)) }}
<source srcset="{{ $featured.Permalink }}" />
<img src="{{ $featured.Permalink }}" alt="{{ default $.Title .Params.description }}" />
</picture>
{{ with $source.Params.credits }}
<span>Credits: {{ . | $.Page.RenderString | safeHTML }}</span>
{{ end }}
</div>
{{ end }}
{{ end }}
<section class="gblog-markdown">
{{ partial "content" . }}
</section>
</article>
<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>
{{ end }}
<section class="gblog-markdown">
{{ partial "content" . }}
</section>
</article>
{{ 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/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 }}">
<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
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 name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
{{ $description := default (default .Site.Title .Site.Params.description) (default .Summary .Description) }}
{{ $keywords := default .Site.Params.Keywords .Keywords }}
{{ $authors := default (slice .Site.Params.GeekblogAuthor) .Params.authors }}
{{ with $description }}
<meta name="description" content="{{ . }}">
<meta name="description" content="{{ . }}" />
{{ end }}
{{ with $keywords }}
<meta name="keywords" content="{{ delimit . "," }}">
<meta name="keywords" content="{{ delimit . "," }}" />
{{ end }}
{{ with $authors }}
{{ $list := slice }}
{{ range sort . }}
{{ with . }}
{{ $author := index $.Site.Data.authors . }}
{{ $list = $list | append $author.name }}
{{ end }}
{{ $list := slice }}
{{ range sort . }}
{{ with . }}
{{ $author := index $.Site.Data.authors . }}
{{ $list = $list | append $author.name }}
{{ end }}
{{ end }}
{{ with $list }}
<meta name="author" content="{{ delimit . "," }}">
{{ end }}
{{ with $list }}
<meta name="author" content="{{ delimit . "," }}" />
{{ end }}
{{ end }}

View File

@ -1,27 +1,77 @@
<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 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"
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 rel="stylesheet" href="{{ index (index .Site.Data.assets "main.scss") "src" | relURL }}" media="all">
<link
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 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 "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 rel="stylesheet" href="{{ index (index .Site.Data.assets "print.scss") "src" | relURL }}" media="print">
<link
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 rel="stylesheet" href="{{ index (index .Site.Data.assets "custom.css") "src" | relURL }}" media="all">
<link
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" }}
{{ 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 }}
{{ if (default false $.Site.Params.GeekblogOverwriteHTMLBase) }}
<base href="{{ .Site.BaseURL }}">
<base href="{{ .Site.BaseURL }}" />
{{ end }}
{{ printf "<!-- %s -->" "Made with Geekblog theme https://github.com/thegeeklab/hugo-geekblog" | safeHTML }}

View File

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

View File

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

View File

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

View File

@ -1,45 +1,75 @@
<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:url" content="{{ .Permalink }}" />
{{- with $.Params.images -}}
{{- range first 6 . }}<meta property="og:image" content="{{ . | absURL }}" />{{ end -}}
{{- range first 6 . }}<meta property="og:image" content="{{ . | absURL }}" />{{ end -}}
{{- else -}}
{{- $images := $.Resources.ByType "image" -}}
{{- $featured := $images.GetMatch "*feature*" -}}
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
{{- with $featured -}}
<meta property="og:image" content="{{ $featured.Permalink }}"/>
{{- else -}}
{{- with $.Site.Params.images }}<meta property="og:image" content="{{ index . 0 | absURL }}"/>{{ end -}}
{{- end -}}
{{- $images := $.Resources.ByType "image" -}}
{{- $featured := $images.GetMatch "*feature*" -}}
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
{{- with $featured -}}
<meta property="og:image" content="{{ $featured.Permalink }}" />
{{- else -}}
{{- with $.Site.Params.images }}
<meta property="og:image" content="{{ index . 0 | absURL }}" />
{{ end -}}
{{- end -}}
{{- end -}}
{{- 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 }}
{{- $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 }}
{{- with .Params.videos }}
{{- range . }}
<meta property="og:video" content="{{ . | absURL }}" />
{{ end }}
{{ end }}
{{- /* If it is part of a series, link to related articles */}}
{{- if .Site.Taxonomies.series }}
{{- $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 }}<meta property="og:see_also" content="{{ $page.Permalink }}" />{{ end }}
{{- end }}
{{ end }}{{ end }}
{{- $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 }}
<meta property="og:see_also" content="{{ $page.Permalink }}" />
{{ end }}
{{- end }}
{{ end }}
{{ end }}
{{- end }}
{{- /* Facebook Page Admin ID for Domain Insights */}}

View File

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

View File

@ -1,15 +1,20 @@
{{ $pag := $.Paginator }}
<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 }}
<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 }}
</div>
<div class="gblog-paging__state">Page {{ $pag.PageNumber }} of {{ $pag.TotalPages }}</div>
<div class="gblog-paging__item gblog-paging__item--next">
</div>
<div class="gblog-paging__state">Page {{ $pag.PageNumber }} of {{ $pag.TotalPages }}</div>
<div class="gblog-paging__item gblog-paging__item--next">
{{ 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 }}
</div>
</div>
</nav>

View File

@ -1,56 +1,60 @@
<footer class="gblog-footer">
<nav class="container flex">
<div>
<section class="flex flex-wrap align-center">
{{ with (.Site.GetPage "home").OutputFormats.Get "atom" }}
<span class="gblog-footer__item gblog-footer__item--row">
<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>
</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>
<nav class="container flex">
<div>
<section class="flex flex-wrap align-center">
{{ with (.Site.GetPage "home").OutputFormats.Get "atom" }}
<span class="gblog-footer__item gblog-footer__item--row">
<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>
</span>
{{ 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>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,8 @@
{{ $tocLevels := default (default 6 .Site.Params.GeekblogToC) .Page.Params.GeekblogToC }}
{{ 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 }}