refactor: replace gulp by webpack and npm scripts (#258)
BREAKING CHANGE: We have replaced `gulp` with `webpack` and `npm scripts` to build this theme. If you build it on your own or use build commands during the deployment, you may have to adjust your setup. BREAKING CHANGE: The `GeekblogIcons` font is using the icon name as Unicode now. As a consequence, you have to replace all references to Icons from this font if you have customized the theme. BREAKING CHANGE: We have refactored the search integration to split Hugo templates from JavaScript code. To get it working again, you need to adjust the `outputFormats` and `outputs` in your Hugo configuration file, as [documented](https://geekdocs.de/usage/configuration/#site-configuration).
This commit is contained in:
parent
2ac2a9faab
commit
5c5e2d59cb
122 changed files with 18705 additions and 5208 deletions
|
@ -1,40 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="{{ .Site.Language.Lang }}">
|
||||
|
||||
<head>
|
||||
<head>
|
||||
{{ partial "head/meta" . }}
|
||||
<title>Lost? Don't worry</title>
|
||||
|
||||
{{ partial "head/favicons" . }}
|
||||
{{ partial "head/others" . }}
|
||||
</head>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body>
|
||||
{{ partial "svg-icon-symbols" . }}
|
||||
|
||||
|
||||
<div class="wrapper">
|
||||
<input type="checkbox" class="hidden" id="menu-header-control" />
|
||||
{{ partial "site-header" (dict "Root" . "MenuEnabled" false) }}
|
||||
<input type="checkbox" class="hidden" id="menu-header-control" />
|
||||
{{ partial "site-header" (dict "Root" . "MenuEnabled" false) }}
|
||||
|
||||
<main class="gdoc-error flex-even">
|
||||
<div class="flex align-center justify-center">
|
||||
<div class="gdoc-error__icon">
|
||||
<svg class="icon gdoc_cloud_off"><use xlink:href="#gdoc_cloud_off"></use></svg>
|
||||
</div>
|
||||
<div class="gdoc-error__message">
|
||||
<div class="gdoc-error__line gdoc-error__title">Lost?</div>
|
||||
<div class="gdoc-error__line gdoc-error__code">Error 404</div>
|
||||
<div class="gdoc-error__line gdoc-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="gdoc-error__link" href="{{ .Site.BaseURL }}">homepage</a>.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<main class="gdoc-error flex-even">
|
||||
<div class="flex align-center justify-center">
|
||||
<div class="gdoc-error__icon">
|
||||
<svg class="icon gdoc_cloud_off"><use xlink:href="#gdoc_cloud_off"></use></svg>
|
||||
</div>
|
||||
<div class="gdoc-error__message">
|
||||
<div class="gdoc-error__line gdoc-error__title">Lost?</div>
|
||||
<div class="gdoc-error__line gdoc-error__code">Error 404</div>
|
||||
<div class="gdoc-error__line gdoc-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="gdoc-error__link" href="{{ .Site.BaseURL }}">homepage</a>.
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
{{ partial "site-footer" . }}
|
||||
{{ partial "site-footer" . }}
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
{{- $showAnchor := (and (default true .Page.Params.GeekdocAnchor) (default true .Page.Site.Params.GeekdocAnchor)) -}}
|
||||
|
||||
|
||||
<!-- prettier-ignore-start -->
|
||||
{{- if $showAnchor -}}
|
||||
<div class="gdoc-page__anchorwrap">
|
||||
<h{{ .Level }} id="{{ .Anchor | safeURL }}">
|
||||
|
@ -16,3 +18,4 @@
|
|||
</h{{ .Level }}>
|
||||
</div>
|
||||
{{- end -}}
|
||||
<!-- prettier-ignore-end -->
|
||||
|
|
|
@ -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 */ -}}
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
{{- $raw := or (hasPrefix .Text "<img") (hasPrefix .Text "<figure") -}}
|
||||
<a class="gdoc-markdown__link{{ if $raw }}--raw{{ end }}" href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}>{{ .Text | safeHTML }}</a>
|
||||
<a
|
||||
class="gdoc-markdown__link{{ if $raw }}--raw{{ end }}"
|
||||
href="{{ .Destination | safeURL }}"
|
||||
{{ with .Title }}title="{{ . }}"{{ end }}
|
||||
>{{ .Text | safeHTML }}</a
|
||||
>
|
||||
{{- /* Drop trailing newlines */ -}}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="{{ .Site.Language.Lang }}" class="color-toggle-hidden">
|
||||
|
||||
<head>
|
||||
<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,33 +12,38 @@
|
|||
{{ partial "head/others" . }}
|
||||
{{ partial "head/schema" . }}
|
||||
{{ partial "head/custom" . }}
|
||||
</head>
|
||||
</head>
|
||||
|
||||
<body itemscope itemtype="https://schema.org/WebPage">
|
||||
<body itemscope itemtype="https://schema.org/WebPage">
|
||||
{{ partial "svg-icon-symbols" . }}
|
||||
|
||||
<div class="wrapper {{ if default false .Site.Params.GeekdocDarkModeDim }}dark-mode-dim{{ end }}">
|
||||
<input type="checkbox" class="hidden" id="menu-control" />
|
||||
<input type="checkbox" class="hidden" id="menu-header-control" />
|
||||
{{ $navEnabled := default true .Page.Params.GeekdocNav }}
|
||||
{{ partial "site-header" (dict "Root" . "MenuEnabled" $navEnabled) }}
|
||||
|
||||
<main class="container flex flex-even">
|
||||
{{ if $navEnabled }}
|
||||
<aside class="gdoc-nav">
|
||||
{{ partial "menu" . }}
|
||||
</aside>
|
||||
{{ end }}
|
||||
<div
|
||||
class="wrapper {{ if default false .Site.Params.GeekdocDarkModeDim }}dark-mode-dim{{ end }}"
|
||||
>
|
||||
<input type="checkbox" class="hidden" id="menu-control" />
|
||||
<input type="checkbox" class="hidden" id="menu-header-control" />
|
||||
{{ $navEnabled := default true .Page.Params.GeekdocNav }}
|
||||
{{ partial "site-header" (dict "Root" . "MenuEnabled" $navEnabled) }}
|
||||
|
||||
<div class="gdoc-page">
|
||||
{{ template "main" . }}
|
||||
{{ partial "page-footer" . }}
|
||||
</div>
|
||||
</main>
|
||||
|
||||
{{ partial "site-footer" . }}
|
||||
<main class="container flex flex-even">
|
||||
{{ if $navEnabled }}
|
||||
<aside class="gdoc-nav">
|
||||
{{ partial "menu" . }}
|
||||
</aside>
|
||||
{{ end }}
|
||||
|
||||
|
||||
<div class="gdoc-page">
|
||||
{{ template "main" . }}
|
||||
{{ partial "page-footer" . }}
|
||||
</div>
|
||||
</main>
|
||||
|
||||
{{ partial "site-footer" . }}
|
||||
</div>
|
||||
|
||||
{{ partial "foot" . }}
|
||||
</body>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
{{ define "main" }}
|
||||
{{ partial "page-header" . }}
|
||||
{{ partial "page-header" . }}
|
||||
|
||||
<article class="gdoc-markdown gdoc-markdown__align--{{ default "left" (.Page.Params.GeekdocAlign | lower) }}">
|
||||
<h1>{{ partial "title" . }}</h1>
|
||||
{{ partial "content" . }}
|
||||
</article>
|
||||
|
||||
<article
|
||||
class="gdoc-markdown gdoc-markdown__align--{{ default "left" (.Page.Params.GeekdocAlign | lower) }}"
|
||||
>
|
||||
<h1>{{ partial "title" . }}</h1>
|
||||
{{ partial "content" . }}
|
||||
</article>
|
||||
{{ end }}
|
||||
|
|
7
layouts/_default/list.search.json
Normal file
7
layouts/_default/list.search.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{{- $searchDataFile := printf "%s.searchdata.json" .Language.Lang -}}
|
||||
{{- $searchData := resources.Get "search/searchdata.json" | resources.ExecuteAsTemplate $searchDataFile . | resources.Minify -}}
|
||||
{
|
||||
"dataFile": {{ $searchData.RelPermalink | jsonify }},
|
||||
"indexConfig": {{ .Site.Params.GeekdocSearchConfig | jsonify }},
|
||||
"showParent": {{ if .Site.Params.GeekdocSearchShowParent }}true{{ else }}false{{ end }}
|
||||
}
|
|
@ -1,8 +1,11 @@
|
|||
{{ define "main" }}
|
||||
{{ partial "page-header" . }}
|
||||
{{ partial "page-header" . }}
|
||||
|
||||
<article class="gdoc-markdown gdoc-markdown__align--{{ default "left" (.Page.Params.GeekdocAlign | lower) }}">
|
||||
<h1>{{ partial "title" . }}</h1>
|
||||
{{ partial "content" . }}
|
||||
</article>
|
||||
|
||||
<article
|
||||
class="gdoc-markdown gdoc-markdown__align--{{ default "left" (.Page.Params.GeekdocAlign | lower) }}"
|
||||
>
|
||||
<h1>{{ partial "title" . }}</h1>
|
||||
{{ partial "content" . }}
|
||||
</article>
|
||||
{{ end }}
|
||||
|
|
|
@ -1,14 +1,3 @@
|
|||
{{ if default true .Site.Params.GeekdocSearch }}
|
||||
{{ .Scratch.Set "geekdocSearchConfig" .Site.Params.GeekdocSearchConfig }}
|
||||
<!-- Remove after https://github.com/gohugoio/hugo/issues/6331 -->
|
||||
{{ $searchJSFile := printf "js/%s.search.js" .Language.Lang }}
|
||||
{{ $searchJS := resources.Get "js/search.js" | resources.ExecuteAsTemplate $searchJSFile . | resources.Minify | fingerprint }}
|
||||
<script defer src="{{ $searchJS.RelPermalink }}"></script>
|
||||
<script defer src="{{ index (index .Site.Data.assets "search.js") "src" | relURL }}"></script>
|
||||
{{ end }}
|
||||
|
||||
{{ if default true .Site.Params.GeekdocAnchorCopy }}
|
||||
<script defer src="{{ index .Site.Data.assets "js/clipboard.min.js" | relURL }}"></script>
|
||||
<script defer src="{{ index .Site.Data.assets "js/clipboard-loader.min.js" | relURL }}"></script>
|
||||
{{ end }}
|
||||
|
||||
<script defer src="{{ index .Site.Data.assets "js/copycode.min.js" | relURL }}"></script>
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
<link rel="icon" type="image/svg+xml" href="{{ "favicon/favicon.svg" | 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="32x32"
|
||||
href="{{ "favicon/favicon-32x32.png" | relURL }}"
|
||||
/>
|
||||
<link
|
||||
rel="icon"
|
||||
type="image/png"
|
||||
sizes="16x16"
|
||||
href="{{ "favicon/favicon-16x16.png" | relURL }}"
|
||||
/>
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
<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" />
|
||||
<meta name="color-scheme" content="light dark" />
|
||||
|
||||
{{ $description := default (default .Site.Title .Site.Params.description) (default .Summary .Description) }}
|
||||
{{ $keywords := default .Site.Params.Keywords .Keywords }}
|
||||
|
||||
{{ with $description }}
|
||||
<meta name="description" content="{{ . }}">
|
||||
<meta name="description" content="{{ . }}" />
|
||||
{{ end }}
|
||||
{{ with $keywords }}
|
||||
<meta name="keywords" content="{{ delimit . "," }}">
|
||||
<meta name="keywords" content="{{ delimit . "," }}" />
|
||||
{{ end }}
|
||||
|
|
|
@ -1,22 +1,66 @@
|
|||
<script src="{{ index .Site.Data.assets "js/darkmode.min.js" | 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 rel="preload" as="font" href="{{ "fonts/LiberationSans.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" href="{{ index .Site.Data.assets "main.min.css" | relURL }}" as="style">
|
||||
<link rel="stylesheet" href="{{ index .Site.Data.assets "main.min.css" | 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 .Site.Data.assets "mobile.min.css" | relURL }}" as="style">
|
||||
<link rel="stylesheet" href="{{ index .Site.Data.assets "mobile.min.css" | 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 .Site.Data.assets "print.min.css" | relURL }}" as="style">
|
||||
<link rel="stylesheet" href="{{ index .Site.Data.assets "print.min.css" | 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 .Site.Data.assets "custom.css" | relURL }}" as="style">
|
||||
<link rel="stylesheet" href="{{ index .Site.Data.assets "custom.css" | 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"
|
||||
/>
|
||||
|
||||
{{ if (default false $.Site.Params.GeekdocOverwriteHTMLBase) }}
|
||||
<base href="{{ .Site.BaseURL }}">
|
||||
<base href="{{ .Site.BaseURL }}" />
|
||||
{{ end }}
|
||||
|
||||
{{ printf "<!-- %s -->" "Made with Geekdoc theme https://github.com/thegeeklab/hugo-geekdoc" | safeHTML }}
|
||||
|
|
|
@ -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",
|
||||
|
@ -10,7 +9,7 @@
|
|||
"description": "{{ . }}",
|
||||
{{- end }}
|
||||
"thumbnailUrl": "{{ $thumbnail }}"
|
||||
{{- with .Site.Params.GeekblogContentLicense }},
|
||||
{{- with .Site.Params.GeekdocContentLicense }},
|
||||
"license": "{{ .name }}"
|
||||
{{- end }}
|
||||
}
|
||||
|
|
|
@ -1,54 +1,81 @@
|
|||
{{ $current := .current }}
|
||||
{{ template "menu-file" dict "sect" .source "current" $current "site" $current.Site }}
|
||||
|
||||
|
||||
<!-- template -->
|
||||
{{ define "menu-file" }}
|
||||
{{ $current := .current }}
|
||||
{{ $site := .site }}
|
||||
{{ $current := .current }}
|
||||
{{ $site := .site }}
|
||||
|
||||
<ul class="gdoc-nav__list">
|
||||
{{ range sort (default (seq 0) .sect) "weight" }}
|
||||
{{ $current.Scratch.Set "current" $current }}
|
||||
{{ $current.Scratch.Set "site" $site }}
|
||||
|
||||
<li>
|
||||
<ul class="gdoc-nav__list">
|
||||
{{ range sort (default (seq 0) .sect) "weight" }}
|
||||
{{ $current.Scratch.Set "current" $current }}
|
||||
{{ $current.Scratch.Set "site" $site }}
|
||||
|
||||
|
||||
<li>
|
||||
{{ $ref := default false .ref }}
|
||||
{{ if $ref}}
|
||||
{{ $site := $current.Scratch.Get "site" }}
|
||||
{{ $this := $site.GetPage .ref }}
|
||||
{{ $current := $current.Scratch.Get "current" }}
|
||||
{{ $icon := default false .icon }}
|
||||
{{ $numberOfPages := (add (len $this.Pages) (len $this.Sections)) }}
|
||||
{{ $isCurrent := eq $current $this }}
|
||||
{{ $isAncestor := $this.IsAncestor $current }}
|
||||
{{ $id := substr (sha1 $this.Permalink) 0 8 }}
|
||||
{{ $doCollapse := and (isset . "sub") (or $this.Params.GeekdocCollapseSection (default false .Site.Params.GeekdocCollapseAllSections)) }}
|
||||
{{ if $ref }}
|
||||
{{ $site := $current.Scratch.Get "site" }}
|
||||
{{ $this := $site.GetPage .ref }}
|
||||
{{ $current := $current.Scratch.Get "current" }}
|
||||
{{ $icon := default false .icon }}
|
||||
{{ $numberOfPages := (add (len $this.Pages) (len $this.Sections)) }}
|
||||
{{ $isCurrent := eq $current $this }}
|
||||
{{ $isAncestor := $this.IsAncestor $current }}
|
||||
{{ $id := substr (sha1 $this.Permalink) 0 8 }}
|
||||
{{ $doCollapse := and (isset . "sub") (or $this.Params.GeekdocCollapseSection (default false .Site.Params.GeekdocCollapseAllSections)) }}
|
||||
|
||||
|
||||
<input
|
||||
type="checkbox"
|
||||
{{ if $doCollapse }}
|
||||
<input type="checkbox" id="{{ printf "navtree-%s" $id }}" class="gdoc-nav__toggle" {{ if or $isCurrent $isAncestor }}checked{{ end }}>
|
||||
<label for="{{ printf "navtree-%s" $id }}" class="flex justify-between">
|
||||
class="gdoc-nav__toggle" id="{{ printf "navtree-%s" $id }}"
|
||||
{{ if or $isCurrent $isAncestor }}checked{{ end }}
|
||||
{{ else }}
|
||||
class="hidden"
|
||||
{{ end }}
|
||||
/>
|
||||
<label
|
||||
{{ if $doCollapse }}
|
||||
for="{{ printf "navtree-%s" $id }}" class="flex justify-between"
|
||||
{{ end }}
|
||||
>
|
||||
<span class="flex">
|
||||
{{ if $icon }}<svg class="icon {{ .icon }}"><use xlink:href="#{{ .icon }}"></use></svg>{{ end }}
|
||||
<a href="{{ if .external }}{{ .ref }}{{ else }}{{ relref $current .ref }}{{ end }}"
|
||||
class="gdoc-nav__entry {{ if not .external }}{{ if $isCurrent }}is-active{{ end }}{{ end }}">
|
||||
{{ .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="gdoc-nav__entry {{ if not .external }}
|
||||
{{ if $isCurrent }}is-active{{ end }}
|
||||
{{ end }}"
|
||||
>
|
||||
{{ .name }}
|
||||
</a>
|
||||
</span>
|
||||
{{ if $doCollapse }}
|
||||
<svg class="icon gdoc_keyborad_arrow_left"><use xlink:href="#gdoc_keyborad_arrow_left"></use></svg>
|
||||
<svg class="icon gdoc_keyborad_arrow_down hidden"><use xlink:href="#gdoc_keyborad_arrow_down"></use></svg>
|
||||
</label>
|
||||
<svg class="icon gdoc_keyborad_arrow_left">
|
||||
<use xlink:href="#gdoc_keyborad_arrow_left"></use>
|
||||
</svg>
|
||||
<svg class="icon gdoc_keyborad_arrow_down hidden">
|
||||
<use xlink:href="#gdoc_keyborad_arrow_down"></use>
|
||||
</svg>
|
||||
{{ end }}
|
||||
</label>
|
||||
{{ else }}
|
||||
<span class="flex">{{ .name }}</span>
|
||||
<span class="flex">{{ .name }}</span>
|
||||
{{ end }}
|
||||
|
||||
{{ with .sub }}
|
||||
{{ template "menu-file" dict "sect" . "current" ($current.Scratch.Get "current") "site" ($current.Scratch.Get "site") }}
|
||||
{{ template "menu-file" dict "sect" . "current" ($current.Scratch.Get "current") "site" ($current.Scratch.Get "site") }}
|
||||
{{ end }}
|
||||
</li>
|
||||
|
||||
{{ end }}
|
||||
</ul>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
|
|
|
@ -1,33 +1,41 @@
|
|||
{{ $current := .current }}
|
||||
{{ template "menu-extra" dict "sect" .source "current" $current "site" $current.Site "target" .target }}
|
||||
|
||||
|
||||
<!-- template -->
|
||||
{{ define "menu-extra" }}
|
||||
{{ $current := .current }}
|
||||
{{ $site := .site }}
|
||||
{{ $target := .target }}
|
||||
{{ $sect := .sect }}
|
||||
{{ $current := .current }}
|
||||
{{ $site := .site }}
|
||||
{{ $target := .target }}
|
||||
{{ $sect := .sect }}
|
||||
|
||||
{{ 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 not .icon }}
|
||||
{{ if not .icon }}
|
||||
{{ errorf "Missing 'icon' attribute in data file for '%s' menu item '%s'" $target .name }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if eq $target "header" }}
|
||||
{{ if eq $target "header" }}
|
||||
<span>
|
||||
<a href="{{ if .external }}{{ .ref }}{{ else }}{{ relref $current .ref }}{{ end }}" class="gdoc-header__link">
|
||||
<a
|
||||
href="{{ if .external }}
|
||||
{{ .ref }}
|
||||
{{ else }}
|
||||
{{ relref $current .ref }}
|
||||
{{ end }}"
|
||||
class="gdoc-header__link"
|
||||
>
|
||||
<svg class="icon {{ .icon }}">
|
||||
<title>{{ .name }}</title>
|
||||
<use xlink:href="#{{ .icon }}"></use>
|
||||
<title>{{ .name }}</title>
|
||||
<use xlink:href="#{{ .icon }}"></use>
|
||||
</svg>
|
||||
</a>
|
||||
</a>
|
||||
</span>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
|
|
@ -1,77 +1,97 @@
|
|||
{{ $current := . }}
|
||||
{{ template "tree-nav" dict "sect" .Site.Home.Sections "current" $current }}
|
||||
|
||||
|
||||
<!-- templates -->
|
||||
{{ define "tree-nav" }}
|
||||
{{ $current := .current }}
|
||||
{{ $current := .current }}
|
||||
|
||||
<ul class="gdoc-nav__list">
|
||||
{{ $sortBy := (default "title" .current.Site.Params.GeekdocFileTreeSortBy | lower) }}
|
||||
{{ range .sect.GroupBy "Weight" }}
|
||||
{{ $rangeBy := .ByTitle }}
|
||||
|
||||
{{ if eq $sortBy "title" }}
|
||||
{{ $rangeBy = .ByTitle }}
|
||||
{{ else if eq $sortBy "linktitle" }}
|
||||
{{ $rangeBy = .ByLinkTitle }}
|
||||
{{ else if eq $sortBy "date" }}
|
||||
{{ $rangeBy = .ByDate }}
|
||||
{{ else if eq $sortBy "publishdate" }}
|
||||
{{ $rangeBy = .ByPublishDate }}
|
||||
{{ else if eq $sortBy "expirydate" }}
|
||||
{{ $rangeBy = .ByExpiryDate }}
|
||||
{{ else if eq $sortBy "lastmod" }}
|
||||
{{ $rangeBy = .ByLastmod }}
|
||||
{{ else if eq $sortBy "title_reverse" }}
|
||||
{{ $rangeBy = .ByTitle.Reverse }}
|
||||
{{ else if eq $sortBy "linktitle_reverse" }}
|
||||
{{ $rangeBy = .ByLinkTitle.Reverse }}
|
||||
{{ else if eq $sortBy "date_reverse" }}
|
||||
{{ $rangeBy = .ByDate.Reverse }}
|
||||
{{ else if eq $sortBy "publishdate_reverse" }}
|
||||
{{ $rangeBy = .ByPublishDate.Reverse }}
|
||||
{{ else if eq $sortBy "expirydate_reverse" }}
|
||||
{{ $rangeBy = .ByExpiryDate.Reverse }}
|
||||
{{ else if eq $sortBy "lastmod_reverse" }}
|
||||
{{ $rangeBy = .ByLastmod.Reverse }}
|
||||
{{ end }}
|
||||
<ul class="gdoc-nav__list">
|
||||
{{ $sortBy := (default "title" .current.Site.Params.GeekdocFileTreeSortBy | lower) }}
|
||||
{{ range .sect.GroupBy "Weight" }}
|
||||
{{ $rangeBy := .ByTitle }}
|
||||
|
||||
{{ range $rangeBy }}
|
||||
{{ if not .Params.GeekdocHidden }}
|
||||
{{ if eq $sortBy "title" }}
|
||||
{{ $rangeBy = .ByTitle }}
|
||||
{{ else if eq $sortBy "linktitle" }}
|
||||
{{ $rangeBy = .ByLinkTitle }}
|
||||
{{ else if eq $sortBy "date" }}
|
||||
{{ $rangeBy = .ByDate }}
|
||||
{{ else if eq $sortBy "publishdate" }}
|
||||
{{ $rangeBy = .ByPublishDate }}
|
||||
{{ else if eq $sortBy "expirydate" }}
|
||||
{{ $rangeBy = .ByExpiryDate }}
|
||||
{{ else if eq $sortBy "lastmod" }}
|
||||
{{ $rangeBy = .ByLastmod }}
|
||||
{{ else if eq $sortBy "title_reverse" }}
|
||||
{{ $rangeBy = .ByTitle.Reverse }}
|
||||
{{ else if eq $sortBy "linktitle_reverse" }}
|
||||
{{ $rangeBy = .ByLinkTitle.Reverse }}
|
||||
{{ else if eq $sortBy "date_reverse" }}
|
||||
{{ $rangeBy = .ByDate.Reverse }}
|
||||
{{ else if eq $sortBy "publishdate_reverse" }}
|
||||
{{ $rangeBy = .ByPublishDate.Reverse }}
|
||||
{{ else if eq $sortBy "expirydate_reverse" }}
|
||||
{{ $rangeBy = .ByExpiryDate.Reverse }}
|
||||
{{ else if eq $sortBy "lastmod_reverse" }}
|
||||
{{ $rangeBy = .ByLastmod.Reverse }}
|
||||
{{ end }}
|
||||
|
||||
{{ $numberOfPages := (add (len .Pages) (len .Sections)) }}
|
||||
{{ $isParent := and (ne $numberOfPages 0) (not .Params.GeekdocFlatSection) }}
|
||||
{{ $isCurrent := eq $current . }}
|
||||
{{ $isAncestor := .IsAncestor $current }}
|
||||
{{ $id := substr (sha1 .Permalink) 0 8 }}
|
||||
{{ $doCollapse := and $isParent (or .Params.GeekdocCollapseSection (default false .Site.Params.GeekdocCollapseAllSections)) }}
|
||||
{{ range $rangeBy }}
|
||||
{{ if not .Params.GeekdocHidden }}
|
||||
|
||||
<li>
|
||||
{{ if $doCollapse }}
|
||||
<input type="checkbox" id="{{ printf "navtree-%s" $id }}" class="gdoc-nav__toggle" {{ if or $isCurrent $isAncestor }}checked{{ end }}>
|
||||
<label for="{{ printf "navtree-%s" $id }}" class="flex justify-between">
|
||||
{{ end }}
|
||||
{{ if or .Content .Params.GeekdocFlatSection }}
|
||||
{{ $numberOfPages := (add (len .Pages) (len .Sections)) }}
|
||||
{{ $isParent := and (ne $numberOfPages 0) (not .Params.GeekdocFlatSection) }}
|
||||
{{ $isCurrent := eq $current . }}
|
||||
{{ $isAncestor := .IsAncestor $current }}
|
||||
{{ $id := substr (sha1 .Permalink) 0 8 }}
|
||||
{{ $doCollapse := and $isParent (or .Params.GeekdocCollapseSection (default false .Site.Params.GeekdocCollapseAllSections)) }}
|
||||
|
||||
|
||||
<li>
|
||||
<input
|
||||
type="checkbox"
|
||||
{{ if $doCollapse }}
|
||||
class="gdoc-nav__toggle" id="{{ printf "navtree-%s" $id }}"
|
||||
{{ if or $isCurrent $isAncestor }}checked{{ end }}
|
||||
{{ else }}
|
||||
class="hidden"
|
||||
{{ end }}
|
||||
/>
|
||||
<label
|
||||
{{ if $doCollapse }}
|
||||
for="{{ printf "navtree-%s" $id }}" class="flex justify-between"
|
||||
{{ end }}
|
||||
>
|
||||
{{ if or .Content .Params.GeekdocFlatSection }}
|
||||
<span class="flex">
|
||||
<a href="{{ .RelPermalink }}" class="gdoc-nav__entry {{ if eq $current . }}is-active{{ end }}">
|
||||
{{ partial "title" . }}
|
||||
</a>
|
||||
<a
|
||||
href="{{ .RelPermalink }}"
|
||||
class="gdoc-nav__entry {{ if eq $current . }}is-active{{ end }}"
|
||||
>
|
||||
{{ partial "title" . }}
|
||||
</a>
|
||||
</span>
|
||||
{{ else }}
|
||||
{{ else }}
|
||||
<span class="flex">{{ partial "title" . }}</span>
|
||||
{{ end }}
|
||||
{{ if $doCollapse }}
|
||||
<svg class="icon gdoc_keyborad_arrow_left"><use xlink:href="#gdoc_keyborad_arrow_left"></use></svg>
|
||||
<svg class="icon gdoc_keyborad_arrow_down"><use xlink:href="#gdoc_keyborad_arrow_down"></use></svg>
|
||||
{{ end }}
|
||||
{{ if $doCollapse }}
|
||||
<svg class="icon gdoc_keyborad_arrow_left">
|
||||
<use xlink:href="#gdoc_keyborad_arrow_left"></use>
|
||||
</svg>
|
||||
<svg class="icon gdoc_keyborad_arrow_down">
|
||||
<use xlink:href="#gdoc_keyborad_arrow_down"></use>
|
||||
</svg>
|
||||
{{ end }}
|
||||
</label>
|
||||
{{ end }}
|
||||
|
||||
{{ if $isParent }}
|
||||
{{ template "tree-nav" dict "sect" .Pages "current" $current}}
|
||||
{{ end }}
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ template "tree-nav" dict "sect" .Pages "current" $current }}
|
||||
{{ end }}
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
|
|
|
@ -1,35 +1,42 @@
|
|||
<nav>
|
||||
{{ partial "search" . }}
|
||||
{{ partial "search" . }}
|
||||
|
||||
<section class="gdoc-nav--main">
|
||||
<h2>Navigation</h2>
|
||||
{{ if .Site.Params.GeekdocMenuBundle }}
|
||||
{{ partial "menu-bundle" (dict "current" . "source" .Site.Data.menu.main.main) }}
|
||||
{{ else }}
|
||||
{{ partial "menu-filetree" . }}
|
||||
{{ end }}
|
||||
</section>
|
||||
|
||||
{{ if and (in (slice "posts" "tags") .Section) (default false .Site.Params.GeekdocTagsToMenu) }}
|
||||
<section class="gdoc-nav--tags">
|
||||
<h2>Tags</h2>
|
||||
<ul class="gdoc-nav__list">
|
||||
{{ $currentPage := .RelPermalink }}
|
||||
{{ range $name, $taxonomy := .Site.Taxonomies.tags }}
|
||||
{{ with $.Site.GetPage (printf "/tags/%s" $name) }}
|
||||
<li>
|
||||
<a class="gdoc-nav__entry {{ if eq $currentPage .RelPermalink }} is-active {{ end }}" href="{{ .RelPermalink }}">{{ .Title }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
</section>
|
||||
<section class="gdoc-nav--main">
|
||||
<h2>Navigation</h2>
|
||||
{{ if .Site.Params.GeekdocMenuBundle }}
|
||||
{{ partial "menu-bundle" (dict "current" . "source" .Site.Data.menu.main.main) }}
|
||||
{{ else }}
|
||||
{{ partial "menu-filetree" . }}
|
||||
{{ end }}
|
||||
</section>
|
||||
|
||||
<section class="gdoc-nav--more">
|
||||
{{ if .Site.Data.menu.more.more }}
|
||||
<h2>More</h2>
|
||||
{{ partial "menu-bundle" (dict "current" . "source" .Site.Data.menu.more.more) }}
|
||||
{{ if and (in (slice "posts" "tags") .Section) (default false .Site.Params.GeekdocTagsToMenu) }}
|
||||
<section class="gdoc-nav--tags">
|
||||
<h2>Tags</h2>
|
||||
<ul class="gdoc-nav__list">
|
||||
{{ $currentPage := .RelPermalink }}
|
||||
{{ range $name, $taxonomy := .Site.Taxonomies.tags }}
|
||||
{{ with $.Site.GetPage (printf "/tags/%s" $name) }}
|
||||
<li>
|
||||
<a
|
||||
class="gdoc-nav__entry {{ if eq $currentPage .RelPermalink }}is-active{{ end }}"
|
||||
href="{{ .RelPermalink }}"
|
||||
>
|
||||
{{ .Title }}
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
</section>
|
||||
{{ end }}
|
||||
|
||||
|
||||
<section class="gdoc-nav--more">
|
||||
{{ if .Site.Data.menu.more.more }}
|
||||
<h2>More</h2>
|
||||
{{ partial "menu-bundle" (dict "current" . "source" .Site.Data.menu.more.more) }}
|
||||
{{ end }}
|
||||
</section>
|
||||
</nav>
|
||||
|
|
|
@ -9,52 +9,64 @@
|
|||
{{ template "menu_nextprev" dict "sect" $.Site.Data.menu.main.main "current" $current "site" $site }}
|
||||
|
||||
{{ define "menu_nextprev" }}
|
||||
{{ $current := .current }}
|
||||
{{ $site := .site }}
|
||||
{{ $current := .current }}
|
||||
{{ $site := .site }}
|
||||
|
||||
{{ range sort (default (seq 0) .sect) "weight" }}
|
||||
{{ $current.Scratch.Set "current" $current }}
|
||||
{{ $current.Scratch.Set "site" $site }}
|
||||
{{ range sort (default (seq 0) .sect) "weight" }}
|
||||
{{ $current.Scratch.Set "current" $current }}
|
||||
{{ $current.Scratch.Set "site" $site }}
|
||||
|
||||
{{ $ref := default false .ref }}
|
||||
{{ if $ref}}
|
||||
{{ $site := $current.Scratch.Get "site" }}
|
||||
{{ $this := $site.GetPage .ref }}
|
||||
{{ $current := $current.Scratch.Get "current" }}
|
||||
{{ $ref := default false .ref }}
|
||||
{{ if $ref }}
|
||||
{{ $site := $current.Scratch.Get "site" }}
|
||||
{{ $this := $site.GetPage .ref }}
|
||||
{{ $current := $current.Scratch.Get "current" }}
|
||||
|
||||
{{ if $current.Scratch.Get "getNext" }}
|
||||
{{ $current.Scratch.Set "nextPage" (dict "name" .name "this" $this) }}
|
||||
{{ $current.Scratch.Set "getNext" false }}
|
||||
{{ end }}
|
||||
{{ if $current.Scratch.Get "getNext" }}
|
||||
{{ $current.Scratch.Set "nextPage" (dict "name" .name "this" $this) }}
|
||||
{{ $current.Scratch.Set "getNext" false }}
|
||||
{{ end }}
|
||||
|
||||
{{ if eq $current $this }}
|
||||
{{ $current.Scratch.Set "prevPage" ($current.Scratch.Get "prev") }}
|
||||
{{ $current.Scratch.Set "getNext" true }}
|
||||
{{ end }}
|
||||
{{ if eq $current $this }}
|
||||
{{ $current.Scratch.Set "prevPage" ($current.Scratch.Get "prev") }}
|
||||
{{ $current.Scratch.Set "getNext" true }}
|
||||
{{ end }}
|
||||
|
||||
{{ $current.Scratch.Set "prev" (dict "name" .name "this" $this) }}
|
||||
{{ end }}
|
||||
|
||||
{{ $sub := default false .sub }}
|
||||
{{ if $sub }}
|
||||
{{ template "menu_nextprev" dict "sect" $sub "current" ($current.Scratch.Get "current") "site" ($current.Scratch.Get "site") }}
|
||||
{{ end }}
|
||||
{{ $current.Scratch.Set "prev" (dict "name" .name "this" $this) }}
|
||||
{{ end }}
|
||||
|
||||
{{ $sub := default false .sub }}
|
||||
{{ if $sub }}
|
||||
{{ template "menu_nextprev" dict "sect" $sub "current" ($current.Scratch.Get "current") "site" ($current.Scratch.Get "site") }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
<div class="gdoc-page__footer flex flex-wrap justify-between">
|
||||
{{ $showPrevNext := (and (default true .Site.Params.GeekdocNextPrev) .Site.Params.GeekdocMenuBundle) }}
|
||||
{{ if $showPrevNext }}
|
||||
<span class="gdoc-page__nav">
|
||||
{{ with ($current.Scratch.Get "prevPage") }}
|
||||
<a class="gdoc-page__nav--prev flex align-center" href="{{.this.RelPermalink}}" title="{{ .name }}"> {{ .name }}</a>
|
||||
{{ end }}
|
||||
</span>
|
||||
<span class="gdoc-page__nav">
|
||||
{{ with ($current.Scratch.Get "nextPage") }}
|
||||
<a class="gdoc-page__nav--next flex align-center" href="{{.this.RelPermalink}}" title="{{ .name }}">{{ .name }} </a>
|
||||
{{ end }}
|
||||
</span>
|
||||
{{ end }}
|
||||
{{ $showPrevNext := (and (default true .Site.Params.GeekdocNextPrev) .Site.Params.GeekdocMenuBundle) }}
|
||||
{{ if $showPrevNext }}
|
||||
<span class="gdoc-page__nav">
|
||||
{{ with ($current.Scratch.Get "prevPage") }}
|
||||
<a
|
||||
class="gdoc-page__nav--prev flex align-center"
|
||||
href="{{ .this.RelPermalink }}"
|
||||
title="{{ .name }}"
|
||||
>
|
||||
{{ .name }}
|
||||
</a>
|
||||
{{ end }}
|
||||
</span>
|
||||
<span class="gdoc-page__nav">
|
||||
{{ with ($current.Scratch.Get "nextPage") }}
|
||||
<a
|
||||
class="gdoc-page__nav--next flex align-center"
|
||||
href="{{ .this.RelPermalink }}"
|
||||
title="{{ .name }}"
|
||||
>
|
||||
{{ .name }}
|
||||
</a>
|
||||
{{ end }}
|
||||
</span>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
|
|
@ -1,48 +1,57 @@
|
|||
{{ $geekdocRepo := default (default false .Site.Params.GeekdocRepo) .Page.Params.GeekdocRepo }}
|
||||
{{ $geekdocEditPath := default (default false .Site.Params.GeekdocEditPath) .Page.Params.GeekdocEditPath }}
|
||||
{{ if .File }}
|
||||
{{ $.Scratch.Set "geekdocFilePath" (default .File.Path .Page.Params.GeekdocFilePath) }}
|
||||
{{ $.Scratch.Set "geekdocFilePath" (default .File.Path .Page.Params.GeekdocFilePath) }}
|
||||
{{ else }}
|
||||
{{ $.Scratch.Set "geekdocFilePath" false }}
|
||||
{{ $.Scratch.Set "geekdocFilePath" false }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "breadcrumb" }}
|
||||
{{ $parent := .page.Parent }}
|
||||
{{ if $parent }}
|
||||
{{ $name := (partial "title" $parent) }}
|
||||
{{ $position := (sub .position 1) }}
|
||||
{{ $value := (printf "<li itemprop='itemListElement' itemscope itemtype='https://schema.org/ListItem'><a itemscope itemtype='https://schema.org/WebPage' itemprop='item' itemid='%s' href='%s'><span itemprop='name'>%s</span></a><meta itemprop='position' content='%d' /></li><li> / </li>%s" $parent.RelPermalink $parent.RelPermalink $name $position .value) }}
|
||||
{{ template "breadcrumb" dict "page" $parent "value" $value "position" $position }}
|
||||
{{ else }}
|
||||
{{ .value | safeHTML }}
|
||||
{{ end }}
|
||||
{{ $parent := .page.Parent }}
|
||||
{{ if $parent }}
|
||||
{{ $name := (partial "title" $parent) }}
|
||||
{{ $position := (sub .position 1) }}
|
||||
{{ $value := (printf "<li itemprop='itemListElement' itemscope itemtype='https://schema.org/ListItem'><a itemscope itemtype='https://schema.org/WebPage' itemprop='item' itemid='%s' href='%s'><span itemprop='name'>%s</span></a><meta itemprop='position' content='%d' /></li><li> / </li>%s" $parent.RelPermalink $parent.RelPermalink $name $position .value) }}
|
||||
{{ template "breadcrumb" dict "page" $parent "value" $value "position" $position }}
|
||||
{{ else }}
|
||||
{{ .value | safeHTML }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ $showBreadcrumb := (and (default true .Page.Params.GeekdocBreadcrumb) (default true .Site.Params.GeekdocBreadcrumb)) }}
|
||||
{{ $showEdit := (and ($.Scratch.Get "geekdocFilePath") $geekdocRepo $geekdocEditPath) }}
|
||||
<div class="gdoc-page__header flex flex-wrap
|
||||
{{ if $showBreadcrumb }} justify-between {{ else }} justify-end {{ end }}
|
||||
{{ if not $showEdit }} hidden-mobile {{ end }}
|
||||
{{ if (and (not $showBreadcrumb) (not $showEdit)) }} hidden {{ end }}" itemprop="breadcrumb">
|
||||
{{if $showBreadcrumb }}
|
||||
<div
|
||||
class="gdoc-page__header flex flex-wrap
|
||||
{{ if $showBreadcrumb }}
|
||||
justify-between
|
||||
{{ else }}
|
||||
justify-end
|
||||
{{ end }}
|
||||
{{ if not $showEdit }}hidden-mobile{{ end }}
|
||||
{{ if (and (not $showBreadcrumb) (not $showEdit)) }}hidden{{ end }}"
|
||||
itemprop="breadcrumb"
|
||||
>
|
||||
{{ if $showBreadcrumb }}
|
||||
<div>
|
||||
<svg class="icon gdoc_path hidden-mobile"><use xlink:href="#gdoc_path"></use></svg>
|
||||
<ol class="breadcrumb" itemscope itemtype="https://schema.org/BreadcrumbList">
|
||||
{{ $position := sub (len (split .RelPermalink "/")) 1 }}
|
||||
{{ $name := (partial "title" .) }}
|
||||
{{ $value := (printf "<li itemprop='itemListElement' itemscope itemtype='https://schema.org/ListItem'><span itemprop='name'>%s</span><meta itemprop='position' content='%d' /></li>" $name $position ) }}
|
||||
{{ template "breadcrumb" dict "page" . "value" $value "position" $position }}
|
||||
</ol>
|
||||
<svg class="icon gdoc_path hidden-mobile"><use xlink:href="#gdoc_path"></use></svg>
|
||||
<ol class="breadcrumb" itemscope itemtype="https://schema.org/BreadcrumbList">
|
||||
{{ $position := sub (len (split .RelPermalink "/")) 1 }}
|
||||
{{ $name := (partial "title" .) }}
|
||||
{{ $value := (printf "<li itemprop='itemListElement' itemscope itemtype='https://schema.org/ListItem'><span itemprop='name'>%s</span><meta itemprop='position' content='%d' /></li>" $name $position ) }}
|
||||
{{ template "breadcrumb" dict "page" . "value" $value "position" $position }}
|
||||
</ol>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ if $showEdit }}
|
||||
{{ end }}
|
||||
{{ if $showEdit }}
|
||||
<div>
|
||||
<span class="editpage">
|
||||
<svg class="icon gdoc_code"><use xlink:href="#gdoc_code"></use></svg>
|
||||
<a href="{{ $geekdocRepo }}/{{ path.Join $geekdocEditPath ($.Scratch.Get "geekdocFilePath") }}">
|
||||
Edit this page
|
||||
</a>
|
||||
</span>
|
||||
<span class="editpage">
|
||||
<svg class="icon gdoc_code"><use xlink:href="#gdoc_code"></use></svg>
|
||||
<a
|
||||
href="{{ $geekdocRepo }}/{{ path.Join $geekdocEditPath ($.Scratch.Get "geekdocFilePath") }}"
|
||||
>
|
||||
Edit this page
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
{{ if default true .Site.Params.GeekdocSearch }}
|
||||
<div class="gdoc-search">
|
||||
<svg class="icon gdoc_search"><use xlink:href="#gdoc_search"></use></svg>
|
||||
<input type="text" id="gdoc-search-input" class="gdoc-search__input" placeholder="Search..."
|
||||
aria-label="Search" maxlength="64" />
|
||||
<div class="gdoc-search__spinner spinner hidden"></div>
|
||||
<ul id="gdoc-search-results" class="gdoc-search__list"></ul>
|
||||
</div>
|
||||
<div class="gdoc-search">
|
||||
<svg class="icon gdoc_search"><use xlink:href="#gdoc_search"></use></svg>
|
||||
<input
|
||||
type="text"
|
||||
id="gdoc-search-input"
|
||||
class="gdoc-search__input"
|
||||
placeholder="Search..."
|
||||
aria-label="Search"
|
||||
maxlength="64"
|
||||
/>
|
||||
<div class="gdoc-search__spinner spinner hidden"></div>
|
||||
<ul id="gdoc-search-results" class="gdoc-search__list"></ul>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
|
|
@ -1,29 +1,32 @@
|
|||
<footer class="gdoc-footer">
|
||||
<div class="container flex">
|
||||
<div class="flex flex-wrap">
|
||||
<span class="gdoc-footer__item gdoc-footer__item--row">
|
||||
Built with <a href="https://gohugo.io/" class="gdoc-footer__link">Hugo</a> and
|
||||
<svg class="icon gdoc_heart"><use xlink:href="#gdoc_heart"></use></svg>
|
||||
</span>
|
||||
{{ with .Site.Params.GeekdocLegalNotice }}
|
||||
<span class="gdoc-footer__item gdoc-footer__item--row">
|
||||
<a href="{{ . | relURL }}" class="gdoc-footer__link">Legal Notice</a>
|
||||
</span>
|
||||
{{ end }}
|
||||
{{ with .Site.Params.GeekdocPrivacyPolicy }}
|
||||
<span class="gdoc-footer__item gdoc-footer__item--row">
|
||||
<a href="{{ . | relURL }}" class="gdoc-footer__link">Privacy Policy</a>
|
||||
</span>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ if (default true .Site.Params.GeekdocBackToTop) }}
|
||||
<div class="flex flex-25 justify-end">
|
||||
<span class="gdoc-footer__item text-right">
|
||||
<a class="gdoc-footer__link fake-link" href="#" aria-label="Back to top">
|
||||
<svg class="icon gdoc_keyborad_arrow_up"><use xlink:href="#gdoc_keyborad_arrow_up"></use></svg> <span class="hidden-mobile">Back to top</span>
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
{{ end }}
|
||||
<div class="container flex">
|
||||
<div class="flex flex-wrap">
|
||||
<span class="gdoc-footer__item gdoc-footer__item--row">
|
||||
Built with <a href="https://gohugo.io/" class="gdoc-footer__link">Hugo</a> and
|
||||
<svg class="icon gdoc_heart"><use xlink:href="#gdoc_heart"></use></svg>
|
||||
</span>
|
||||
{{ with .Site.Params.GeekdocLegalNotice }}
|
||||
<span class="gdoc-footer__item gdoc-footer__item--row">
|
||||
<a href="{{ . | relURL }}" class="gdoc-footer__link">Legal Notice</a>
|
||||
</span>
|
||||
{{ end }}
|
||||
{{ with .Site.Params.GeekdocPrivacyPolicy }}
|
||||
<span class="gdoc-footer__item gdoc-footer__item--row">
|
||||
<a href="{{ . | relURL }}" class="gdoc-footer__link">Privacy Policy</a>
|
||||
</span>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ if (default true .Site.Params.GeekdocBackToTop) }}
|
||||
<div class="flex flex-25 justify-end">
|
||||
<span class="gdoc-footer__item text-right">
|
||||
<a class="gdoc-footer__link fake-link" href="#" aria-label="Back to top">
|
||||
<svg class="icon gdoc_keyborad_arrow_up">
|
||||
<use xlink:href="#gdoc_keyborad_arrow_up"></use>
|
||||
</svg>
|
||||
<span class="hidden-mobile">Back to top</span>
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
@ -1,67 +1,73 @@
|
|||
<header class="gdoc-header">
|
||||
<div class="container flex align-center justify-between">
|
||||
{{ if .MenuEnabled }}
|
||||
<label for="menu-control" class="gdoc-nav__control">
|
||||
<svg class="icon gdoc_menu">
|
||||
<title>Open Nav Menu</title>
|
||||
<use xlink:href="#gdoc_menu"></use>
|
||||
</svg>
|
||||
<svg class="icon gdoc_arrow_back">
|
||||
<title>Close Nav Menu</title>
|
||||
<use xlink:href="#gdoc_arrow_back"></use>
|
||||
</svg>
|
||||
</label>
|
||||
<div class="container flex align-center justify-between">
|
||||
{{ if .MenuEnabled }}
|
||||
<label for="menu-control" class="gdoc-nav__control">
|
||||
<svg class="icon gdoc_menu">
|
||||
<title>Open Nav Menu</title>
|
||||
<use xlink:href="#gdoc_menu"></use>
|
||||
</svg>
|
||||
<svg class="icon gdoc_arrow_back">
|
||||
<title>Close Nav Menu</title>
|
||||
<use xlink:href="#gdoc_arrow_back"></use>
|
||||
</svg>
|
||||
</label>
|
||||
{{ end }}
|
||||
<a class="gdoc-header__link" href="{{ .Root.Site.BaseURL }}">
|
||||
<span class="gdoc-brand flex align-center">
|
||||
<img
|
||||
class="gdoc-brand__img"
|
||||
src="{{ (default "brand.svg" .Root.Site.Params.GeekdocLogo) | relURL }}"
|
||||
alt=""
|
||||
/>
|
||||
<span class="gdoc-brand__title">{{ .Root.Site.Title }}</span>
|
||||
</span>
|
||||
</a>
|
||||
<div class="gdoc-menu-header">
|
||||
<span {{ if .Root.Site.Data.menu.extra.header }}class="gdoc-menu-header__items"{{ end }}>
|
||||
{{ if .Root.Site.Data.menu.extra.header }}
|
||||
{{ partial "menu-extra" (dict "current" .Root "source" .Root.Site.Data.menu.extra.header "target" "header") }}
|
||||
{{ end }}
|
||||
<a class="gdoc-header__link" href="{{ .Root.Site.BaseURL }}">
|
||||
<span class="gdoc-brand flex align-center">
|
||||
<img class="gdoc-brand__img" src="{{ (default "brand.svg" .Root.Site.Params.GeekdocLogo) | relURL }}" alt="">
|
||||
<span class="gdoc-brand__title">{{ .Root.Site.Title }}</span>
|
||||
</span>
|
||||
</a>
|
||||
<div class="gdoc-menu-header">
|
||||
{{ if .Root.Site.Data.menu.extra.header }}
|
||||
<span class="gdoc-menu-header__items">
|
||||
{{ partial "menu-extra" (dict "current" .Root "source" .Root.Site.Data.menu.extra.header "target" "header") }}
|
||||
{{ end }}
|
||||
<span id="gdoc-dark-mode">
|
||||
<svg class="icon gdoc_brightness_dark">
|
||||
<title>Toggle Dark/Light/Auto mode</title>
|
||||
<use xlink:href="#gdoc_brightness_dark"></use>
|
||||
</svg>
|
||||
<svg class="icon gdoc_brightness_light">
|
||||
<title>Toggle Dark/Light/Auto mode</title>
|
||||
<use xlink:href="#gdoc_brightness_light"></use>
|
||||
</svg>
|
||||
<svg class="icon gdoc_brightness_auto">
|
||||
<title>Toggle Dark/Light/Auto mode</title>
|
||||
<use xlink:href="#gdoc_brightness_auto"></use>
|
||||
</svg>
|
||||
</span>
|
||||
{{ if .Root.Site.Data.menu.extra.header }}
|
||||
<span class="gdoc-menu-header__home">
|
||||
<span id="gdoc-dark-mode">
|
||||
<svg class="icon gdoc_brightness_dark">
|
||||
<title>Toggle Dark/Light/Auto mode</title>
|
||||
<use xlink:href="#gdoc_brightness_dark"></use>
|
||||
</svg>
|
||||
<svg class="icon gdoc_brightness_light">
|
||||
<title>Toggle Dark/Light/Auto mode</title>
|
||||
<use xlink:href="#gdoc_brightness_light"></use>
|
||||
</svg>
|
||||
<svg class="icon gdoc_brightness_auto">
|
||||
<title>Toggle Dark/Light/Auto mode</title>
|
||||
<use xlink:href="#gdoc_brightness_auto"></use>
|
||||
</svg>
|
||||
</span>
|
||||
{{ if .Root.Site.Data.menu.extra.header }}
|
||||
<span class="gdoc-menu-header__home">
|
||||
<a href="{{ .Root.Site.BaseURL }}" class="gdoc-header__link">
|
||||
<svg class="icon gdoc_home">
|
||||
<title>Back to homepage</title>
|
||||
<use xlink:href="#gdoc_home"></use>
|
||||
</svg>
|
||||
<svg class="icon gdoc_home">
|
||||
<title>Back to homepage</title>
|
||||
<use xlink:href="#gdoc_home"></use>
|
||||
</svg>
|
||||
</a>
|
||||
</span>
|
||||
<span class="gdoc-menu-header__control">
|
||||
</span>
|
||||
<span class="gdoc-menu-header__control">
|
||||
<label for="menu-header-control">
|
||||
<svg class="icon gdoc_keyborad_arrow_right">
|
||||
<use xlink:href="#gdoc_keyborad_arrow_right"></use>
|
||||
<title>Close Menu Bar</title>
|
||||
</svg>
|
||||
<svg class="icon gdoc_keyborad_arrow_right">
|
||||
<use xlink:href="#gdoc_keyborad_arrow_right"></use>
|
||||
<title>Close Menu Bar</title>
|
||||
</svg>
|
||||
</label>
|
||||
</span>
|
||||
</span>
|
||||
<label for="menu-header-control" class="gdoc-menu-header__control">
|
||||
<svg class="icon gdoc_keyborad_arrow_left">
|
||||
<use xlink:href="#gdoc_keyborad_arrow_left"></use>
|
||||
<title>Open Menu Bar</title>
|
||||
</svg>
|
||||
</label>
|
||||
{{ end }}
|
||||
</div>
|
||||
</span>
|
||||
{{ end }}
|
||||
</span>
|
||||
{{ if .Root.Site.Data.menu.extra.header }}
|
||||
<label for="menu-header-control" class="gdoc-menu-header__control">
|
||||
<svg class="icon gdoc_keyborad_arrow_left">
|
||||
<use xlink:href="#gdoc_keyborad_arrow_left"></use>
|
||||
<title>Open Menu Bar</title>
|
||||
</svg>
|
||||
</label>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{{ range resources.Match "sprites/*.svg" }}
|
||||
{{ printf "<!-- geekdoc include: %s -->" . | safeHTML }}
|
||||
{{ .Content | safeHTML }}
|
||||
{{ printf "<!-- geekdoc include: %s -->" . | safeHTML }}
|
||||
{{ .Content | safeHTML }}
|
||||
{{ end }}
|
||||
|
|
|
@ -1,62 +1,74 @@
|
|||
{{ define "main" }}
|
||||
{{ range .Paginator.Pages }}
|
||||
<article class="gdoc-markdown gdoc-post">
|
||||
<header class="gdoc-post__header">
|
||||
<h1 class="gdoc-post__title"><a href="{{ .RelPermalink }}">{{ .Title }}</a></h1>
|
||||
</header>
|
||||
<section>
|
||||
{{ .Summary }}
|
||||
</section>
|
||||
<div class="gdoc-post__readmore">
|
||||
{{ if .Truncated }}
|
||||
<a class="flex-inline align-center fake-link" title="Read full post" href="{{ .RelPermalink }}">Read full post</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ range .Paginator.Pages }}
|
||||
<article class="gdoc-markdown gdoc-post">
|
||||
<header class="gdoc-post__header">
|
||||
<h1 class="gdoc-post__title"><a href="{{ .RelPermalink }}">{{ .Title }}</a></h1>
|
||||
</header>
|
||||
<section>
|
||||
{{ .Summary }}
|
||||
</section>
|
||||
<div class="gdoc-post__readmore">
|
||||
{{ if .Truncated }}
|
||||
<a
|
||||
class="flex-inline align-center fake-link"
|
||||
title="Read full post"
|
||||
href="{{ .RelPermalink }}"
|
||||
>
|
||||
Read full post
|
||||
</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<footer class="gdoc-post__footer">
|
||||
<footer class="gdoc-post__footer">
|
||||
<span class="no-wrap">
|
||||
<svg class="icon gdoc_date"><use xlink:href="#gdoc_date"></use></svg>
|
||||
<span class="gdoc-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 gdoc_timer"><use xlink:href="#gdoc_timer"></use></svg>
|
||||
<span class="gdoc-post__tag">{{ .ReadingTime }} min read</span>
|
||||
</span>
|
||||
|
||||
{{ $tc := 0 }}
|
||||
{{ with .Params.tags }}
|
||||
{{ range sort . }}
|
||||
{{ $name := . }}
|
||||
{{ with $.Site.GetPage (printf "/tags/%s" $name | urlize) }}
|
||||
{{ if eq $tc 0 }}
|
||||
<span class="no-wrap">
|
||||
<svg class="icon gdoc_date"><use xlink:href="#gdoc_date"></use></svg>
|
||||
<span class="gdoc-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 gdoc_bookmark"><use xlink:href="#gdoc_bookmark"></use></svg>
|
||||
{{ template "post-tag" dict "name" $name "page" . }}
|
||||
</span>
|
||||
|
||||
<span class="no-wrap">
|
||||
<svg class="icon gdoc_timer"><use xlink:href="#gdoc_timer"></use></svg>
|
||||
<span class="gdoc-post__tag">{{ .ReadingTime }} min read</span>
|
||||
</span>
|
||||
|
||||
{{ $tc := 0 }}
|
||||
{{ with .Params.tags }}
|
||||
{{ range sort . }}
|
||||
{{ $name := . }}
|
||||
{{ with $.Site.GetPage (printf "/tags/%s" $name | urlize) }}
|
||||
{{ if eq $tc 0 }}
|
||||
<span class="no-wrap">
|
||||
<svg class="icon gdoc_bookmark"><use xlink:href="#gdoc_bookmark"></use></svg>
|
||||
{{ template "post-tag" dict "name" $name "page" . }}
|
||||
</span>
|
||||
{{ else }}
|
||||
{{ template "post-tag" dict "name" $name "page" . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ $tc = (add $tc 1) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</footer>
|
||||
</article>
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ template "post-tag" dict "name" $name "page" . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ $tc = (add $tc 1) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</footer>
|
||||
</article>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "post-tag" }}
|
||||
<span class="gdoc-post__tag">
|
||||
<span class="gdoc-post__tag">
|
||||
<span class="gdoc-button">
|
||||
<a class="gdoc-button__link" href="{{ .page.RelPermalink }}" title="All posts tagged with '{{ .name }}'">{{ .name }}</a>
|
||||
<a
|
||||
class="gdoc-button__link"
|
||||
href="{{ .page.RelPermalink }}"
|
||||
title="All posts tagged with '{{ .name }}'"
|
||||
>
|
||||
{{ .name }}
|
||||
</a>
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
{{ end }}
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
{{ define "main" }}
|
||||
<article class="gdoc-markdown gdoc-post">
|
||||
<header class="gdoc-post__header">
|
||||
<h1 class="gdoc-post__title">{{ .Title }}</h1>
|
||||
<div class="gdoc-post__meta">
|
||||
<span class="no-wrap">
|
||||
<svg class="icon gdoc_date"><use xlink:href="#gdoc_date"></use></svg>
|
||||
<span class="gdoc-post__tag">
|
||||
<time datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}">
|
||||
{{ if ne (.Lastmod.Format "2006-01-02") (.Date.Format "2006-01-02") }}
|
||||
Updated on
|
||||
{{ end }}
|
||||
{{ .Lastmod.Format "Jan 2, 2006" }}
|
||||
</time>
|
||||
</span>
|
||||
<article class="gdoc-markdown gdoc-post">
|
||||
<header class="gdoc-post__header">
|
||||
<h1 class="gdoc-post__title">{{ .Title }}</h1>
|
||||
<div class="gdoc-post__meta">
|
||||
<span class="no-wrap">
|
||||
<svg class="icon gdoc_date"><use xlink:href="#gdoc_date"></use></svg>
|
||||
<span class="gdoc-post__tag">
|
||||
<time datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}">
|
||||
{{ if ne (.Lastmod.Format "2006-01-02") (.Date.Format "2006-01-02") }}
|
||||
Updated on
|
||||
{{ end }}
|
||||
{{ .Lastmod.Format "Jan 2, 2006" }}
|
||||
</time>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<span class="no-wrap">
|
||||
<svg class="icon gdoc_timer"><use xlink:href="#gdoc_timer"></use></svg>
|
||||
<span class="gdoc-post__tag">{{ .ReadingTime }} min read</span>
|
||||
</span>
|
||||
<span class="no-wrap">
|
||||
<svg class="icon gdoc_timer"><use xlink:href="#gdoc_timer"></use></svg>
|
||||
<span class="gdoc-post__tag">{{ .ReadingTime }} min read</span>
|
||||
</span>
|
||||
</div>
|
||||
</header>
|
||||
<div>
|
||||
{{ partial "content" . }}
|
||||
</div>
|
||||
</article>
|
||||
</header>
|
||||
<div>
|
||||
{{ partial "content" . }}
|
||||
</div>
|
||||
</article>
|
||||
{{ end }}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
{{ $size := default "regular" (.Get "size" | lower) }}
|
||||
|
||||
{{ if not (in (slice "regular" "large") $size) }}
|
||||
{{ $size = "regular" }}
|
||||
{{ $size = "regular" }}
|
||||
{{ end }}
|
||||
|
||||
{{ with .Get "href" }}
|
||||
|
@ -15,8 +15,13 @@
|
|||
{{ $ref = relref $ . }}
|
||||
{{ end }}
|
||||
|
||||
<span class="gdoc-button gdoc-button--{{ $size }}{{ with .Get "class" }} {{ . }}{{ end }}">
|
||||
<a {{ with $ref }} href="{{.}}" {{ end }} {{ with $target }} target="{{.}}" {{ end }} class="gdoc-button__link">
|
||||
{{ $.Inner }}
|
||||
</a>
|
||||
|
||||
<span class="gdoc-button gdoc-button--{{ $size }}{{ with .Get "class" }}{{ . }}{{ end }}">
|
||||
<a
|
||||
{{ with $ref }}href="{{ . }}"{{ end }}
|
||||
{{ with $target }}target="{{ . }}"{{ end }}
|
||||
class="gdoc-button__link"
|
||||
>
|
||||
{{ $.Inner }}
|
||||
</a>
|
||||
</span>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div class="gdoc-columns flex flex-wrap flex-mobile-column">
|
||||
{{ range split .Inner "<--->" }}
|
||||
<div class="gdoc-columns__content gdoc-markdown--nested flex-even">
|
||||
{{ . | $.Page.RenderString }}
|
||||
</div>
|
||||
<div class="gdoc-columns__content gdoc-markdown--nested flex-even">
|
||||
{{ . | $.Page.RenderString }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
|
|
@ -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 -}}
|
||||
|
|
|
@ -4,26 +4,41 @@
|
|||
{{ $lazyLoad := default (default true $.Site.Params.GeekdocImageLazyLoading) (.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="gdoc-markdown__figure">
|
||||
<a class="gdoc-markdown__link--raw" href="{{ .RelPermalink }}">
|
||||
|
||||
<div class="flex justify-center">
|
||||
<figure class="gdoc-markdown__figure">
|
||||
<a class="gdoc-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 }}
|
||||
|
|
|
@ -4,14 +4,15 @@
|
|||
{{ $language := .Get "language" }}
|
||||
{{ $options :=.Get "options" }}
|
||||
|
||||
|
||||
<div class="gdoc-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>
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
{{ if not (.Page.Scratch.Get "katex") }}
|
||||
<!-- Include katext only first time -->
|
||||
<link rel="stylesheet" href="{{ index .Site.Data.assets "katex.min.css" | relURL }}" />
|
||||
<script defer src="{{ index .Site.Data.assets "js/katex.min.js" | relURL }}"></script>
|
||||
<script defer src="{{ index .Site.Data.assets "js/auto-render.min.js" | relURL }}"></script>
|
||||
<script defer src="{{ index .Site.Data.assets "js/katex-loader.min.js" | relURL }}"></script>
|
||||
{{ .Page.Scratch.Set "katex" true }}
|
||||
<!-- Include katext only first time -->
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="{{ index (index .Site.Data.assets "katex.css") "src" | relURL }}"
|
||||
/><script defer src="{{ index (index .Site.Data.assets "katex.js") "src" | relURL }}"></script>
|
||||
{{ .Page.Scratch.Set "katex" true }}
|
||||
{{ end }}
|
||||
|
||||
<span class="gdoc-katex katex{{ with .Get "class" }} {{ . }}{{ end }}">
|
||||
|
||||
<span class="gdoc-katex katex{{ with .Get "class" }}{{ . }}{{ end }}">
|
||||
{{ cond (in .Params "display") "\\[" "\\(" -}}
|
||||
{{- trim .Inner "\n" -}}
|
||||
{{- cond (in .Params "display") "\\]" "\\)" }}
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
{{ if not (.Page.Scratch.Get "mermaid") }}
|
||||
<!-- Include mermaid only first time -->
|
||||
<script defer src="{{ index .Site.Data.assets "js/mermaid.min.js" | relURL }}"></script>
|
||||
<script defer src="{{ index .Site.Data.assets "js/mermaid-loader.min.js" | 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="gdoc-mermaid mermaid{{ with .Get "class" }} {{ . }}{{ end }}">
|
||||
|
||||
<pre class="gdoc-mermaid mermaid{{ with .Get "class" }}{{ printf " %s" . }}{{ end }}">
|
||||
{{- .Inner -}}
|
||||
</pre>
|
||||
|
|
|
@ -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 }}
|
||||
|
|
|
@ -2,10 +2,16 @@
|
|||
{{ $id := .Get 0 }}
|
||||
{{ $group := printf "tabs-%s" $id }}
|
||||
|
||||
|
||||
<div class="gdoc-tabs">
|
||||
{{ range $index, $tab := .Scratch.Get $group }}
|
||||
<input type="radio" class="gdoc-tabs__control hidden" name="{{ $group }}" id="{{ printf "%s-%d" $group $index }}"
|
||||
{{ if not $index }}checked="checked" {{ end }} />
|
||||
<input
|
||||
type="radio"
|
||||
class="gdoc-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="gdoc-tabs__label">
|
||||
{{ $tab.Name }}
|
||||
</label>
|
||||
|
|
|
@ -1,32 +1,38 @@
|
|||
{{ $tocLevels := default (default 6 .Site.Params.GeekdocToC) .Page.Params.GeekdocToC }}
|
||||
|
||||
{{ if $tocLevels }}
|
||||
<div class="gdoc-toc gdoc-toc__level--{{$tocLevels}}">
|
||||
<div class="gdoc-toc gdoc-toc__level--{{ $tocLevels }}">
|
||||
{{ template "toc-tree" dict "sect" .Page.Pages }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
|
||||
<!-- templates -->
|
||||
{{ define "toc-tree" }}
|
||||
<ul>
|
||||
{{ range .sect.GroupBy "Weight" }}
|
||||
{{ range .ByTitle }}
|
||||
{{ if or (not .Params.GeekdocHidden) (not (default true .Params.GeekdocHiddenTocTree)) }}
|
||||
<li>
|
||||
{{ if or .Content .Params.GeekdocFlatSection }}
|
||||
<span>
|
||||
<a href="{{ .RelPermalink }}" class="gdoc-toc__entry">{{ partial "title" . }}{{ with .Params.GeekdocDescription }}:</a> {{ . }}{{ else }}</a>{{ end }}
|
||||
</span>
|
||||
{{ else }}
|
||||
<span>{{ partial "title" . }}{{ with .Params.GeekdocDescription }}: {{ . }}{{ end }}</span>
|
||||
{{ end }}
|
||||
{{ if or (not .Params.GeekdocHidden) (not (default true .Params.GeekdocHiddenTocTree)) }}
|
||||
<li>
|
||||
{{ if or .Content .Params.GeekdocFlatSection }}
|
||||
<span>
|
||||
<a href="{{ .RelPermalink }}" class="gdoc-toc__entry">
|
||||
{{ partial "title" . }}{{ with .Params.GeekdocDescription }}:{{ end }}
|
||||
</a>
|
||||
{{ with .Params.GeekdocDescription }}{{ . }}{{ end }}
|
||||
</span>
|
||||
{{ else }}
|
||||
<span>
|
||||
{{ partial "title" . }}{{ with .Params.GeekdocDescription }}: {{ . }}{{ end }}
|
||||
</span>
|
||||
{{ end }}
|
||||
|
||||
{{ $numberOfPages := (add (len .Pages) (len .Sections)) }}
|
||||
{{ if and (ne $numberOfPages 0) (not .Params.GeekdocFlatSection) }}
|
||||
{{ template "toc-tree" dict "sect" .Pages }}
|
||||
{{ end }}
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ $numberOfPages := (add (len .Pages) (len .Sections)) }}
|
||||
{{ if and (ne $numberOfPages 0) (not .Params.GeekdocFlatSection) }}
|
||||
{{ template "toc-tree" dict "sect" .Pages }}
|
||||
{{ end }}
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
{{ $tocLevels := default (default 6 .Site.Params.GeekdocToC) .Page.Params.GeekdocToC }}
|
||||
|
||||
{{ if and $tocLevels .Page.TableOfContents }}
|
||||
<div class="gdoc-toc gdoc-toc__level--{{$tocLevels}}">{{ .Page.TableOfContents }}<hr></div>
|
||||
<div class="gdoc-toc gdoc-toc__level--{{ $tocLevels }}">
|
||||
{{ .Page.TableOfContents }}
|
||||
<hr />
|
||||
</div>
|
||||
{{ end }}
|
||||
|
|
|
@ -1,62 +1,74 @@
|
|||
{{ define "main" }}
|
||||
{{ range .Paginator.Pages }}
|
||||
<article class="gdoc-markdown gdoc-post">
|
||||
<header class="gdoc-post__header">
|
||||
<h1 class="gdoc-post__title"><a href="{{ .RelPermalink }}">{{ .Title }}</a></h1>
|
||||
</header>
|
||||
<section>
|
||||
{{ .Summary }}
|
||||
</section>
|
||||
<div class="gdoc-post__readmore">
|
||||
{{ if .Truncated }}
|
||||
<a class="flex-inline align-center fake-link" title="Read full post" href="{{ .RelPermalink }}">Read full post</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ range .Paginator.Pages }}
|
||||
<article class="gdoc-markdown gdoc-post">
|
||||
<header class="gdoc-post__header">
|
||||
<h1 class="gdoc-post__title"><a href="{{ .RelPermalink }}">{{ .Title }}</a></h1>
|
||||
</header>
|
||||
<section>
|
||||
{{ .Summary }}
|
||||
</section>
|
||||
<div class="gdoc-post__readmore">
|
||||
{{ if .Truncated }}
|
||||
<a
|
||||
class="flex-inline align-center fake-link"
|
||||
title="Read full post"
|
||||
href="{{ .RelPermalink }}"
|
||||
>
|
||||
Read full post
|
||||
</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<footer class="gdoc-post__footer">
|
||||
<footer class="gdoc-post__footer">
|
||||
<span class="no-wrap">
|
||||
<svg class="icon gdoc_date"><use xlink:href="#gdoc_date"></use></svg>
|
||||
<span class="gdoc-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 gdoc_timer"><use xlink:href="#gdoc_timer"></use></svg>
|
||||
<span class="gdoc-post__tag">{{ .ReadingTime }} min read</span>
|
||||
</span>
|
||||
|
||||
{{ $tc := 0 }}
|
||||
{{ with .Params.tags }}
|
||||
{{ range sort . }}
|
||||
{{ $name := . }}
|
||||
{{ with $.Site.GetPage (printf "/tags/%s" $name | urlize) }}
|
||||
{{ if eq $tc 0 }}
|
||||
<span class="no-wrap">
|
||||
<svg class="icon gdoc_date"><use xlink:href="#gdoc_date"></use></svg>
|
||||
<span class="gdoc-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 gdoc_bookmark"><use xlink:href="#gdoc_bookmark"></use></svg>
|
||||
{{ template "post-tag" dict "name" $name "page" . }}
|
||||
</span>
|
||||
|
||||
<span class="no-wrap">
|
||||
<svg class="icon gdoc_timer"><use xlink:href="#gdoc_timer"></use></svg>
|
||||
<span class="gdoc-post__tag">{{ .ReadingTime }} min read</span>
|
||||
</span>
|
||||
|
||||
{{ $tc := 0 }}
|
||||
{{ with .Params.tags }}
|
||||
{{ range sort . }}
|
||||
{{ $name := . }}
|
||||
{{ with $.Site.GetPage (printf "/tags/%s" $name | urlize) }}
|
||||
{{ if eq $tc 0 }}
|
||||
<span class="no-wrap">
|
||||
<svg class="icon gdoc_bookmark"><use xlink:href="#gdoc_bookmark"></use></svg>
|
||||
{{ template "post-tag" dict "name" $name "page" . }}
|
||||
</span>
|
||||
{{ else }}
|
||||
{{ template "post-tag" dict "name" $name "page" . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ $tc = (add $tc 1) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</footer>
|
||||
</article>
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ template "post-tag" dict "name" $name "page" . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ $tc = (add $tc 1) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</footer>
|
||||
</article>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ define "post-tag" }}
|
||||
<span class="gdoc-post__tag">
|
||||
<span class="gdoc-post__tag">
|
||||
<span class="gdoc-button">
|
||||
<a class="gdoc-button__link" href="{{ .page.RelPermalink }}" title="All posts tagged with '{{ .name }}'">{{ .name }}</a>
|
||||
<a
|
||||
class="gdoc-button__link"
|
||||
href="{{ .page.RelPermalink }}"
|
||||
title="All posts tagged with '{{ .name }}'"
|
||||
>
|
||||
{{ .name }}
|
||||
</a>
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
{{ end }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue