Switch to geekblog
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ .Site.Language.Lang }}">
|
||||
|
||||
<head>
|
||||
{{ partial "head/meta" . }}
|
||||
<title>{{ if not (eq .Kind "home") }}{{ partial "title" . }} | {{ end }}{{ .Site.Title }}</title>
|
||||
|
||||
{{ partial "head/favicons" . }}
|
||||
{{ partial "head/others" . }}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{{ partial "svg-icon-symbols" . }}
|
||||
|
||||
<div class="wrapper">
|
||||
{{ partial "site-header" . }}
|
||||
|
||||
<main class="gblog-error flex-even">
|
||||
<div class="flex align-center justify-center">
|
||||
<div class="gblog-error__icon">
|
||||
<svg class="icon telescope"><use xlink:href="#telescope"></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>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
{{ partial "site-footer" . }}
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,18 @@
|
||||
{{ $showAnchor := (and (default true .Page.Params.GeekblogAnchor) (default true .Page.Site.Params.GeekblogAnchor)) }}
|
||||
|
||||
{{ if $showAnchor }}
|
||||
<div class="gblog-post__anchorwrap">
|
||||
<h{{ .Level }} id="{{ .Anchor | safeURL }}">
|
||||
{{ .Text | safeHTML }}
|
||||
<a data-clipboard-text="{{ .Page.Permalink }}#{{ .Anchor | safeURL }}" class="gblog-post__anchor gblog-post__anchor--right clip" aria-label="Anchor {{ .Text | safeHTML }}" href="#{{ .Anchor | safeURL }}">
|
||||
<svg class="icon link"><use xlink:href="#link"></use></svg>
|
||||
</a>
|
||||
</h{{ .Level }}>
|
||||
</div>
|
||||
{{ else }}
|
||||
<div class="gblog-post__anchorwrap">
|
||||
<h{{ .Level }} id="{{ .Anchor | safeURL }}">
|
||||
{{ .Text | safeHTML }}
|
||||
</h{{ .Level }}>
|
||||
</div>
|
||||
{{ end }}
|
||||
@@ -0,0 +1 @@
|
||||
<img src="{{ .Destination | safeURL | relURL }}" alt="{{ .Text }}" {{ with .Title}} title="{{ . }}"{{ end }} />
|
||||
@@ -0,0 +1,2 @@
|
||||
{{- $raw := or (hasPrefix .Text "<img") (hasPrefix .Text "<figure") -}}
|
||||
<a class="gblog-post__link{{ if $raw }}--raw{{ end }}" href="{{ .Destination | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}>{{ .Text | safeHTML }}</a>
|
||||
@@ -0,0 +1,30 @@
|
||||
<!DOCTYPE html>
|
||||
<html itemscope itemtype="http://schema.org/WebPage" lang="{{ .Site.Language.Lang }}">
|
||||
|
||||
<head>
|
||||
{{ partial "head/meta" . }}
|
||||
<title>{{ if not (eq .Kind "home") }}{{ partial "title" . }} | {{ end }}{{ .Site.Title }}</title>
|
||||
|
||||
{{ partial "head/favicons" . }}
|
||||
{{ partial "head/rel-me" . }}
|
||||
{{ partial "head/microformats" . }}
|
||||
{{ partial "head/others" . }}
|
||||
{{ partial "head/schema.html" . }}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{{ partial "svg-icon-symbols" . }}
|
||||
|
||||
<div class="wrapper">
|
||||
{{ partial "site-header" . }}
|
||||
|
||||
<main class="gblog-page container">
|
||||
{{ template "main" . }}
|
||||
</main>
|
||||
|
||||
{{ partial "site-footer" . }}
|
||||
</div>
|
||||
|
||||
{{ partial "foot" . }}
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,71 @@
|
||||
{{ printf `<?xml version="1.0" encoding="utf-8"?>` | safeHTML }} {{/* ref: https://validator.w3.org/feed/docs/atom.html */}}
|
||||
<feed xmlns="http://www.w3.org/2005/Atom"{{ with .Site.Language.Lang }} xml:lang="{{ . }}"{{ end }}>
|
||||
<generator uri="https://gohugo.io/" version="{{ hugo.Version }}">Hugo</generator>
|
||||
{{- $title := .Site.Title -}}
|
||||
{{- with .Title -}}
|
||||
{{- if (not (eq . $title)) -}}
|
||||
{{- $title = printf `%s on %s` . $title -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{ printf `<title type="html"><![CDATA[%s]]></title>` $title | safeHTML }}
|
||||
{{ with .Site.Params.subtitle }}
|
||||
{{ printf `<subtitle type="html"><![CDATA[%s]]></subtitle>` . | safeHTML }}
|
||||
{{ end }}
|
||||
{{ $output_formats := .OutputFormats }}
|
||||
{{ range $output_formats -}}
|
||||
{{- $rel := (or (and (eq "atom" (.Name | lower)) "self") "alternate") -}}
|
||||
{{ with $output_formats.Get .Name }}
|
||||
{{ printf `<link href=%q rel=%q type=%q title=%q />` .Permalink $rel .MediaType.Type .Name | safeHTML }}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
<updated>{{ now.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</updated>
|
||||
{{ with .Site.Params.GeekblogAuthor -}}
|
||||
{{ with index $.Site.Data.authors . }}
|
||||
<author>
|
||||
<name>{{ .name }}</name>
|
||||
{{ with .email }}
|
||||
<email>{{ . }}</email>
|
||||
{{ end -}}
|
||||
</author>
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
<id>{{ .Permalink }}</id>
|
||||
{{- $pages := where .RegularPages "Type" "in" .Site.Params.mainSections -}}
|
||||
{{- if (eq .Kind "home") -}}
|
||||
{{- $pages = where .Site.RegularPages "Type" "in" .Site.Params.mainSections -}}
|
||||
{{- end -}}
|
||||
{{- range $pages }}
|
||||
{{ $page := . }}
|
||||
<entry>
|
||||
{{ printf `<title type="html"><![CDATA[%s]]></title>` .Title | safeHTML }}
|
||||
<link href="{{ .Permalink }}?utm_source=atom_feed" rel="alternate" type="text/html" {{ with .Site.Language.Lang }} hreflang="{{ . }}"{{ end }} />
|
||||
<id>{{ .Permalink }}</id>
|
||||
{{ with .Params.authors -}}
|
||||
{{- range sort . -}}
|
||||
{{ $author := index $.Site.Data.authors . }}
|
||||
<author>
|
||||
<name>{{ $author.name }}</name>
|
||||
</author>
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
<published>{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</published>
|
||||
<updated>{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</updated>
|
||||
{{ $desc := .Description | default "" }}
|
||||
{{ $description := (cond (eq "" $desc) "" (printf "<blockquote>%s</blockquote>" ($desc | $.Page.RenderString))) }}
|
||||
{{ printf `<content type="html"><![CDATA[%s%s]]></content>` $description .Content | safeHTML }}
|
||||
{{ with .Site.Taxonomies }}
|
||||
{{ range $taxo,$_ := . }} <!-- Defaults taxos: "tags", "categories" -->
|
||||
{{ with $page.Param $taxo }}
|
||||
{{ $taxo_list := . }} <!-- $taxo_list will be the tags/categories list -->
|
||||
{{ with $.Site.GetPage (printf "/%s" $taxo) }}
|
||||
{{ $taxonomy_page := . }}
|
||||
{{ range $taxo_list }} <!-- Below, assuming pretty URLs -->
|
||||
<category scheme="{{ printf "%s%s" $taxonomy_page.Permalink (. | urlize) }}" term="{{ (. | urlize) }}" label="{{ . }}" />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</entry>
|
||||
{{ end }}
|
||||
</feed>
|
||||
@@ -0,0 +1,99 @@
|
||||
{{ define "main" }}
|
||||
{{ $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 }}
|
||||
<article class="gblog-post">
|
||||
<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</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<footer class="gblog-post__footer">
|
||||
<span class="no-wrap">
|
||||
<svg class="icon date"><use xlink:href="#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 timer"><use xlink:href="#timer"></use></svg>
|
||||
<span class="gblog-post__tag">{{ .ReadingTime }} min read</span>
|
||||
</span>
|
||||
|
||||
{{ if .Params.weight }}
|
||||
<span class="no-wrap">
|
||||
<svg class="icon pin"><use xlink:href="#pin"></use></svg>
|
||||
<span class="gblog-post__tag">Pinned</span>
|
||||
</span>
|
||||
{{ end }}
|
||||
|
||||
{{ $ac := 0 }}
|
||||
{{ with .Params.authors }}
|
||||
{{ range sort . }}
|
||||
{{ $author := index $.Site.Data.authors . }}
|
||||
{{ with $.Site.GetPage (printf "/authors/%s" . | urlize) }}
|
||||
{{ if eq $ac 0 }}
|
||||
<span class="no-wrap">
|
||||
<svg class="icon person"><use xlink:href="#person"></use></svg>
|
||||
{{ template "post-author" dict "name" $author.name "page" . }}
|
||||
</span>
|
||||
{{ else }}
|
||||
{{ template "post-author" dict "name" $author.name "page" . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ $ac = (add $ac 1) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ $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 bookmarks"><use xlink:href="#bookmarks"></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 }}
|
||||
{{ partial "pagination.html" . }}
|
||||
{{ 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>
|
||||
{{ 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>
|
||||
{{ end }}
|
||||
@@ -0,0 +1,57 @@
|
||||
{{- $title := .Site.Title -}}
|
||||
{{- with .Title -}}
|
||||
{{- if (not (eq . $title)) -}}
|
||||
{{- $title = printf `%s on %s` . $title -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{
|
||||
"version": "https://jsonfeed.org/version/1.1",
|
||||
"title": {{ $title | jsonify }},
|
||||
{{- with .Site.Params.subtitle }}
|
||||
"description": {{ . | jsonify }},
|
||||
{{- end }}
|
||||
"home_page_url" : "{{ .Site.BaseURL }}",
|
||||
{{- with .OutputFormats.Get "json" }}
|
||||
"feed_url" : "{{ .Permalink }}",
|
||||
{{- end }}
|
||||
{{- with .Site.Params.GeekblogAuthor -}}
|
||||
{{ with index $.Site.Data.authors . }}
|
||||
"authors" : [
|
||||
{
|
||||
"name" : "{{ .name }}"{{ with .url }},
|
||||
"url": "{{ . }}"{{ end }}{{ with .avatar }},
|
||||
"avatar": "{{ . }}"{{ end }}
|
||||
}
|
||||
],
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
"items" : [
|
||||
{{- $pages := where .RegularPages "Type" "in" .Site.Params.mainSections -}}
|
||||
{{- if (eq .Kind "home") -}}
|
||||
{{- $pages = where .Site.RegularPages "Type" "in" .Site.Params.mainSections -}}
|
||||
{{- end -}}
|
||||
{{- $len := (len $pages) }}
|
||||
{{- range $i, $page := $pages }}
|
||||
{
|
||||
"title" : {{ .Title | jsonify }},
|
||||
"date_published" : {{ (.Date.Format "2006-01-02T15:04:05Z07:00") | jsonify }},
|
||||
"date_modified" : {{ (.Lastmod.Format "2006-01-02T15:04:05Z07:00") | jsonify }},
|
||||
"id" : "{{ .Permalink }}",
|
||||
"url" : "{{ .Permalink }}",
|
||||
{{- with .Params.authors -}}
|
||||
"authors" : [
|
||||
{{- $authors := (sort .) }}
|
||||
{{- $authors_len := (len $authors) }}
|
||||
{{- range $i, $element := $authors -}}
|
||||
{{- $author := index $.Site.Data.authors $element }}
|
||||
{
|
||||
"name" : "{{ $author.name }}"
|
||||
}{{ if ne (add $i 1) $authors_len }},{{ end }}
|
||||
{{- end }}
|
||||
],
|
||||
{{- end }}
|
||||
"content_html" : {{ .Content | jsonify }}
|
||||
}{{ if ne (add $i 1) $len }},{{ end }}
|
||||
{{- end }}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
{{ 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>
|
||||
{{ if or (eq .Type (default "posts" .Site.Params.GeekblogContentSection)) (eq .Type "post") }}
|
||||
<div class="gblog-post__meta">
|
||||
<span class="no-wrap">
|
||||
<svg class="icon date"><use xlink:href="#date"></use></svg>
|
||||
<span class="gblog-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 timer"><use xlink:href="#timer"></use></svg>
|
||||
<span class="gblog-post__tag">{{ .ReadingTime }} min read</span>
|
||||
</span>
|
||||
</div>
|
||||
{{ end }}
|
||||
</header>
|
||||
|
||||
<section class="gblog-markdown">
|
||||
{{ partial "content" . }}
|
||||
</section>
|
||||
</article>
|
||||
{{ end }}
|
||||
@@ -0,0 +1 @@
|
||||
{{ .Content | replaceRE `<nav id="TableOfContents">\s*<ul>\s*<li>\s*<ul>` `<nav id="TableOfContents"><ul>` | replaceRE `</ul>\s*</li>\s*</ul>\s*</nav>` `</ul></nav>` | safeHTML }}
|
||||
@@ -0,0 +1,8 @@
|
||||
{{ if default true .Site.Params.GeekblogAnchorCopy }}
|
||||
<script defer src="{{ index .Site.Data.assets "js/clipboard.min.js" | relURL }}"></script>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function(event) {
|
||||
var clipboard = new ClipboardJS('.clip');
|
||||
});
|
||||
</script>
|
||||
{{ end }}
|
||||
@@ -0,0 +1,3 @@
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="{{ "favicon/apple-touch-icon.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 }}">
|
||||
@@ -0,0 +1,26 @@
|
||||
<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="{{ . }}">
|
||||
{{ end }}
|
||||
{{ with $keywords }}
|
||||
<meta name="keywords" content="{{ delimit . "," }}">
|
||||
{{ end }}
|
||||
{{ with $authors }}
|
||||
{{ $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 }}
|
||||
{{ end }}
|
||||
@@ -0,0 +1,2 @@
|
||||
{{ template "_internal/opengraph.html" . }}
|
||||
{{ template "_internal/twitter_cards.html" . }}
|
||||
@@ -0,0 +1,26 @@
|
||||
<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/LiberationSans-Bold.woff2" | relURL }}" type="font/woff2" crossorigin="anonymous">
|
||||
<link rel="preload" as="font" href="{{ "fonts/LiberationSans-BoldItalic.woff2" | relURL }}" type="font/woff2" crossorigin="anonymous">
|
||||
<link rel="preload" as="font" href="{{ "fonts/LiberationSans-Italic.woff2" | relURL }}" type="font/woff2" crossorigin="anonymous">
|
||||
<link rel="preload" as="font" href="{{ "fonts/LiberationMono.woff2" | relURL }}" type="font/woff2" crossorigin="anonymous">
|
||||
<link rel="preload" as="font" href="{{ "fonts/DroidSans.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 .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 .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 .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 .Site.Data.assets "custom.css" | relURL }}" as="style">
|
||||
<link rel="stylesheet" href="{{ index .Site.Data.assets "custom.css" | relURL }}" media="all">
|
||||
|
||||
{{ with .OutputFormats.Get "atom" }}
|
||||
{{ printf `<link rel="%s" type="%s" href="%s" title="%s">` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
|
||||
{{ end }}
|
||||
|
||||
{{ printf "<!-- %s -->" "Made with Geekblog theme https://github.com/thegeeklab/hugo-geekblog" | safeHTML }}
|
||||
@@ -0,0 +1 @@
|
||||
<!-- place to set your rel-me links https://microformats.org/wiki/rel-me -->
|
||||
@@ -0,0 +1,85 @@
|
||||
{{ if .IsHome -}}
|
||||
{{ $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",
|
||||
{{ with .Site.Params.GeekblogAuthor -}}
|
||||
{{ with index $.Site.Data.authors . }}"author": "{{ .name }}",{{ end }}
|
||||
{{- end }}
|
||||
"name": "{{ .Site.Title }}",
|
||||
"url": "{{ .Site.BaseURL }}",
|
||||
{{- with .Site.Params.description }}
|
||||
"description": "{{ . }}",
|
||||
{{- end }}
|
||||
"thumbnailUrl": "{{ $thumbnail }}"
|
||||
{{- with .Site.Params.GeekblogContentLicense }},
|
||||
"license": "{{ .name }}"
|
||||
{{- end }}
|
||||
}
|
||||
</script>
|
||||
{{ else if .IsPage }}
|
||||
{{ $authors := default (slice .Site.Params.GeekblogAuthor) .Params.authors }}
|
||||
{{ $description := default .Site.Params.description (default .Description .Summary) }}
|
||||
{{ $ac := 0 }}
|
||||
{{ $ac_max := default 0 (len $authors) }}
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "http://schema.org",
|
||||
"@type": "BlogPosting",
|
||||
"articleSection": "{{ .Section }}",
|
||||
"name": "{{ .Title | safeJS }}",
|
||||
"headline": "{{ .Title | safeJS }}",
|
||||
"alternativeHeadline": "{{ .Params.lead }}",
|
||||
{{- with $description }}
|
||||
"description": "{{ . }}",
|
||||
{{- end }}
|
||||
"inLanguage": {{ .Site.Language.Lang }},
|
||||
"isFamilyFriendly": "true",
|
||||
"mainEntityOfPage": {
|
||||
"@type": "WebPage",
|
||||
"@id": "{{ .Permalink }}"
|
||||
},
|
||||
{{- with $authors }}
|
||||
"author" : [
|
||||
{{- range sort . }}
|
||||
{{- with . -}}
|
||||
{{- $ac = (add $ac 1) }}
|
||||
{{- $author := index $.Site.Data.authors . }}
|
||||
{
|
||||
"@type": "Person",
|
||||
"name": "{{ $author.name }}"
|
||||
}{{ if lt $ac $ac_max }},{{ end }}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
],
|
||||
{{- end }}
|
||||
"copyrightHolder" : "{{ .Site.Title }}",
|
||||
"copyrightYear" : "{{ .Date.Format "2006" }}",
|
||||
"dateCreated": "{{ .Date.Format "2006-01-02T15:04:05.00Z" | safeJS }}",
|
||||
"datePublished": "{{ .PublishDate.Format "2006-01-02T15:04:05.00Z" | safeJS }}",
|
||||
"dateModified": "{{ .Lastmod.Format "2006-01-02T15:04:05.00Z" | safeJS }}",
|
||||
"publisher":{
|
||||
"@type":"Organization",
|
||||
"name": {{ .Site.Title }},
|
||||
"url": {{ .Site.BaseURL }},
|
||||
"logo": {
|
||||
"@type": "ImageObject",
|
||||
"url": "{{ (default "brand.svg" .Site.Params.logo) | absURL }}",
|
||||
"width":"32",
|
||||
"height":"32"
|
||||
}
|
||||
},
|
||||
{{- with $images := $.Resources.ByType "image" }}
|
||||
"image": [ {{ range $i, $image := $images }}{{ if $i }}, {{ end }}"{{ $image.Permalink | absURL }}" {{ end }}],
|
||||
{{- else }}
|
||||
{{- with $images := .Params.images }}
|
||||
"image": [ {{ range $i, $image := $images }}{{ if $i }}, {{ end }}"{{ $image | absURL }}" {{ end }}],
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
"url" : "{{ .Permalink }}",
|
||||
"wordCount" : "{{ .WordCount }}",
|
||||
"genre" : [ {{ range $i, $tag := .Params.tags }}{{ if $i }}, {{ end }}"{{ $tag }}" {{ end }}]
|
||||
}
|
||||
</script>
|
||||
{{ end }}
|
||||
@@ -0,0 +1,35 @@
|
||||
{{ $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 }}
|
||||
|
||||
{{ range sort (default (seq 0) .sect) "weight" }}
|
||||
{{ if isset . "ref" }}
|
||||
{{ $this := $site.GetPage .ref }}
|
||||
{{ $isCurrent := eq $current $this }}
|
||||
{{ $icon := default false .icon }}
|
||||
|
||||
{{ if eq $target "footer" }}
|
||||
<span class="gblog-footer__item">
|
||||
{{ 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" }}
|
||||
<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>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
@@ -0,0 +1,15 @@
|
||||
{{ $pag := $.Paginator }}
|
||||
|
||||
<nav class="gblog-paging flex flex-even align-center" role="navigation">
|
||||
<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 }}">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">
|
||||
{{ if $pag.HasNext }}
|
||||
<a class="flex-inline align-center fake-link no-wrap" href="{{ $pag.Next.URL }}">NEXT</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
</nav>
|
||||
@@ -0,0 +1,38 @@
|
||||
<footer class="gblog-footer">
|
||||
<nav class="container">
|
||||
<section class="flex flex-wrap align-center">
|
||||
{{ with (.Site.GetPage "home").OutputFormats.Get "atom" }}
|
||||
<span class="gblog-footer__item">
|
||||
<svg class="icon rss_feed"><use xlink:href="#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">
|
||||
<a href="{{ . | relURL }}" class="gblog-footer__link">Legal Notice</a>
|
||||
</span>
|
||||
{{ end }}
|
||||
{{ with .Site.Params.GeekblogPrivacyPolicy }}
|
||||
<span class="gblog-footer__item">
|
||||
<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 heart"><use xlink:href="#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 }}
|
||||
</nav>
|
||||
</footer>
|
||||
@@ -0,0 +1,36 @@
|
||||
<header class="gblog-header">
|
||||
<div class="container 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="" width=60 height=60>
|
||||
{{ .Site.Title }}
|
||||
</span>
|
||||
{{ with .Site.Params.subtitle }}
|
||||
<span class="gblog-brand__subtitle flex align-center justify-center">{{ . }}</span>
|
||||
{{ end }}
|
||||
</a>
|
||||
</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 menu"><use xlink:href="#menu"></use></svg>
|
||||
<svg class="icon clear"><use xlink:href="#clear"></use></svg>
|
||||
<span>Nav</span>
|
||||
</label>
|
||||
</div>
|
||||
<ul class="gblog-nav__list container flex flex-wrap justify-center menu-content">
|
||||
{{ $currentPage := .RelPermalink }}
|
||||
{{ 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>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ if .Site.Data.menu.extra.header }}
|
||||
{{ partial "menu-extra" (dict "current" . "source" .Site.Data.menu.extra.header "target" "header") }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
</nav>
|
||||
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,15 @@
|
||||
{{ $title := "" }}
|
||||
|
||||
{{ if .Title }}
|
||||
{{ $title = .Title }}
|
||||
{{ else if and .IsSection .File }}
|
||||
{{ $title = path.Base .File.Dir | humanize | title }}
|
||||
{{ else if and .IsPage .File }}
|
||||
{{ $title = .File.BaseFileName | humanize | title }}
|
||||
{{ end }}
|
||||
|
||||
{{ if eq .Kind "term" }}
|
||||
{{ $title = $title | humanize | title }}
|
||||
{{ end }}
|
||||
|
||||
{{ return $title }}
|
||||
@@ -0,0 +1,3 @@
|
||||
User-agent: *
|
||||
|
||||
Sitemap: {{ "/sitemap.xml" | absURL }}
|
||||
@@ -0,0 +1,17 @@
|
||||
{{ $ref := "" }}
|
||||
{{ $target := "" }}
|
||||
|
||||
{{ with .Get "href" }}
|
||||
{{ $ref = . }}
|
||||
{{ $target = "_blank" }}
|
||||
{{ end }}
|
||||
|
||||
{{ with .Get "relref" }}
|
||||
{{ $ref = relref $ . }}
|
||||
{{ end }}
|
||||
|
||||
<span class="gblog-button{{ with .Get "class" }} {{ . }}{{ end }}">
|
||||
<a {{ with $ref }} href="{{.}}" {{ end }} {{ with $target }} target="{{.}}" {{ end }} class="gblog-button__link">
|
||||
{{ $.Inner }}
|
||||
</a>
|
||||
</span>
|
||||
@@ -0,0 +1,7 @@
|
||||
<div class="gblog-columns flex flex-wrap">
|
||||
{{ range split .Inner "<--->" }}
|
||||
<div class="gblog-columns__content gblog-markdown--nested flex-even">
|
||||
{{ . | $.Page.RenderString }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
@@ -0,0 +1 @@
|
||||
<span class="emoji">{{ .Get 0 | emojify }}</span>
|
||||
@@ -0,0 +1,11 @@
|
||||
{{ $id := substr (sha1 .Inner) 0 8 }}
|
||||
<div class="gblog-expand">
|
||||
<label class="gblog-expand__head flex justify-between" for="{{ $id }}-{{ .Ordinal }}">
|
||||
<span>{{ default "Expand" (.Get 0) }}</span>
|
||||
<span>{{ default "↕" (.Get 1) }}</span>
|
||||
</label>
|
||||
<input id="{{ $id }}-{{ .Ordinal }}" type="checkbox" class="gblog-expand__control hidden" />
|
||||
<div class="gblog-markdown--nested gblog-expand__content">
|
||||
{{ .Inner | $.Page.RenderString }}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,3 @@
|
||||
<blockquote class="gblog-hint {{ .Get 0 }}">
|
||||
{{ .Inner | $.Page.RenderString }}
|
||||
</blockquote>
|
||||
@@ -0,0 +1,40 @@
|
||||
{{ $source := ($.Page.Resources.ByType "image").GetMatch (printf "*%s*" (.Get "name")) }}
|
||||
{{ $customAlt := .Get "alt" }}
|
||||
{{ $customSize := .Get "size" }}
|
||||
{{ $lazyLoad := default (default true $.Site.Params.GeekblogImageLazyLoading) (.Get "lazy") }}
|
||||
|
||||
{{ with $source }}
|
||||
{{ $caption := default .Title $customAlt }}
|
||||
|
||||
{{ $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 }}
|
||||
|
||||
<div class="flex justify-center">
|
||||
<figure class="gblog-post__figure">
|
||||
<a class="gblog-post__link--raw" href="{{ .RelPermalink }}">
|
||||
<img
|
||||
{{ if $lazyLoad }}loading="lazy"{{ end }}
|
||||
{{ with $customSize }}
|
||||
src="{{ index $size $customSize }}" alt="{{ $caption }}"
|
||||
{{ else }}
|
||||
srcset="{{ $size.tiny }} 320w,
|
||||
{{ $size.small }} 600w,
|
||||
{{ $size.medium }} 1200w,
|
||||
{{ $size.large }} 2x"
|
||||
sizes="(max-width: 320px) 320w,
|
||||
(max-width: 600px) 600w,
|
||||
(max-width: 1200px) 1200w,
|
||||
2x"
|
||||
src="{{ $size.large }}" alt="{{ $caption }}"
|
||||
{{ end }}/>
|
||||
</a>
|
||||
{{ with $caption }}
|
||||
<figcaption>{{ . }}{{ with $source.Params.credits }} ({{ . | $.Page.RenderString }}){{ end }}</figcaption>
|
||||
{{ end }}
|
||||
</figure>
|
||||
</div>
|
||||
{{ end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{ 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>
|
||||
document.addEventListener("DOMContentLoaded", function(event) {
|
||||
mermaid.initialize({
|
||||
flowchart: { useMaxWidth: true }
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{{ .Page.Scratch.Set "mermaid" true }}
|
||||
{{ end }}
|
||||
|
||||
<pre class="gblog-mermaid mermaid{{ with .Get "class" }} {{ . }}{{ end }}">
|
||||
{{- .Inner -}}
|
||||
</pre>
|
||||
@@ -0,0 +1,12 @@
|
||||
{{ if .Parent }}
|
||||
{{ $name := .Get 0 }}
|
||||
{{ $group := printf "tabs-%s" (.Parent.Get 0) }}
|
||||
|
||||
{{ if not (.Parent.Scratch.Get $group) }}
|
||||
{{ .Parent.Scratch.Set $group slice }}
|
||||
{{ end }}
|
||||
|
||||
{{ .Parent.Scratch.Add $group (dict "Name" $name "Content" .Inner) }}
|
||||
{{ else }}
|
||||
{{ errorf "%q: 'tab' shortcode must be inside 'tabs' shortcode" .Page.Path }}
|
||||
{{ end}}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{ if .Inner }}{{ end }}
|
||||
{{ $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 }} />
|
||||
<label for="{{ printf "%s-%d" $group $index }}" class="gblog-tabs__label">
|
||||
{{ $tab.Name }}
|
||||
</label>
|
||||
<div class="gblog-markdown--nested gblog-tabs__content">
|
||||
{{ .Content | $.Page.RenderString }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
@@ -0,0 +1,5 @@
|
||||
{{ $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>
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user