migrating from old theme name

This commit is contained in:
2020-05-22 00:23:23 +01:00
parent 3e761a81bc
commit fc10ac84c4
120 changed files with 9019 additions and 16 deletions

0
layouts/404.html Normal file
View File

View File

@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode | default "en-us" }}">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
{{ partial "head.html" . }}
{{ partial "css.html" . }}
{{ partial "schema.html" . }}
</head>
<body>
{{ partial "header.html" . }}
{{ block "main" . }}{{ end }}
{{ partial "footer.html" . }}
{{ partial "foot.html" . }}
{{ template "_internal/google_analytics.html" . }}
{{ partial "js.html" . }}
</body>
</html>

View File

@@ -0,0 +1,21 @@
<div class="card h-100" data-aos="zoom-in">
{{ $page := . }}
<a href="{{ $page.RelPermalink }}" class="d-block">
{{- with $page.Params.images -}}
{{- $images := . -}}
{{- with $page.Site.GetPage "section" "images" -}}
{{- with .Resources.GetMatch (strings.TrimPrefix "/images/" (index $images 0)) -}}
{{- $image := . -}}
<img data-src="{{ $image.RelPermalink }}" class="card-img-top mx-auto d-block pt-2" alt="{{ $page.Title }}">
{{- end -}}
{{- end -}}
{{- end -}}
<div class="card-body">
<h4 class="card-title">{{ $page.Title }}</h4>
<p class="card-text text-muted text-uppercase">{{ $page.Date.Format "January 2, 2006" }}</p>
<div class="card-text">
{{ $page.Summary | plainify }}
</div>
</div>
</a>
</div>

View File

@@ -0,0 +1,5 @@
{{- $.Scratch.Add "index" slice -}}
{{- range .Site.RegularPages -}}
{{- $.Scratch.Add "index" (dict "title" .Title "subtitle" .Params.subtitle "description" .Params.description "tags" .Params.tags "images" .Params.images "content" .Plain "permalink" .Permalink) -}}
{{- end -}}
{{- $.Scratch.Get "index" | jsonify -}}

View File

@@ -0,0 +1,24 @@
{{ define "main" }}
<main class="list container py-6">
{{- if or .Title .Content -}}
<div class="row py-3">
<div class="col">
{{ with .Title }}<h3 class="display-4">{{ . }}</h3>{{ end }}
{{- with .Content -}}
<div class="content">
{{ . }}
</div>
{{- end -}}
</div>
</div>
{{- end -}}
<div class="row row-cols-1 row-cols-lg-3">
{{ range .Pages }}
<div class="col mb-3">
{{ .Render "card" }}
</div>
{{ end }}
</div>
</main>
{{ end }}

View File

@@ -0,0 +1,19 @@
{{ define "main" }}
{{ .Scratch.Set "IsSingle" true }}
<main class="content-page container pt-7 pb-5">
<div class="row">
<div class="col">
<article>
<div class="row justify-content-center">
<div class="col-lg-8">
<h2 class="mb-3">{{ .Title }}</h2>
<div class="content">
{{ .Content }}
</div>
</div>
</div>
</article>
</div>
</div>
</main>
{{ end }}

47
layouts/authors/list.html Normal file
View File

@@ -0,0 +1,47 @@
{{ define "main" }}
<main class="content-page container pt-7 pb-5">
<div class="row">
<div class="col">
<article>
<div class="row justify-content-center">
<div class="col-lg-8">
{{- $term := . -}}
{{- if $term.Params.images -}}
{{- with .Resources.GetMatch (index $term.Params.images 0) -}}
{{- $image := .Resize "300x" -}}
<p class="text-center my-5">
<img data-src="{{ $image.RelPermalink }}" class="img-thumbnail rounded-circle" alt="{{ $term.Params.name }}" data-aos="zoom-in">
</p>
{{- end -}}
{{- end -}}
<h2 class="mb-3">{{ index $term.Params.name 0 }}</h2>
{{- with $term.Params.twitter -}}
<p class="text-muted">
<a href="https://twitter.com/@{{ . | urlize }}">@{{ .}}</a>
</p>
{{- end -}}
<div class="content">
{{ $term.Content }}
</div>
<div class="articles">
<h3>{{ T "articles" }}</h3>
{{- with .Data.Pages -}}
<ul>
{{- range . -}}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{- end -}}
</ul>
{{ end }}
</div>
</div>
</div>
</article>
</div>
</div>
</main>
{{ end }}

View File

@@ -0,0 +1,25 @@
{{ define "main" }}
<main class="content-page container pt-7 pb-5">
<div class="row">
<div class="col">
<article>
<div class="row justify-content-center">
<ul>
{{ range .Data.Pages }}
{{ $page := . }}
{{ range .Params.name }}
<li><a href="{{ $page.Permalink }}">{{ . }}</a></li>
{{ end }}
{{ end }}
</ul>
</div>
<ul>
{{ range .Site.Taxonomies.tags }}
<li><a href="{{ .Page.Permalink }}">{{ .Page.Title }}</a> {{ .Count }}</li>
{{ end }}
</ul>
</article>
</div>
</div>
</main>
{{ end }}

59
layouts/index.html Normal file
View File

@@ -0,0 +1,59 @@
{{ define "main" }}
{{ .Scratch.Set "IsSingle" true }}
<!-- <main class="homepage container py-6" id="front-background"> -->
<img src="/images/front-wallpaper.svg" class="front-background"/ style="opacity: 5% !important;">
<main class="homepage container py-6">
<div>
<!-- Hero -->
<div class="hero row">
{{ .Scratch.Get "IsSingle" }}
<div class="col position-relative py-lg-7{{ if not .Site.Params.homepageImage }} py-7{{ else }} pb-5{{ end }}">
{{- with .Site.Params.homepageImage -}}
<div class="homepage-image" data-aos="zoom-in">
<img src="{{ . | relURL }}" class="img-fluid">
</div>
{{- end -}}
<h1 class="display-4">{{ .Site.Title }}</h1>
{{- with .Site.Params.description -}}
<h3 class="font-weight-normal" style="max-width: 50%;">{{ . | safeHTML }}</h3>
{{- end -}}
</div>
</div>
<!-- Latest article -->
{{- range first 1 (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) -}}
{{ $page := . }}
<div class="latest row py-lg-5">
<div class="col-lg-6 mb-3">
{{- with .Resources.Match "images/banner.svg" -}}
{{ range . }}
{{- $image := . -}}
<a href="{{ $page.RelPermalink }}" class="d-block">
<img data-src="{{ $image.RelPermalink }}" class="img-fluid rounded" alt="{{ $page.Title }}" data-aos="zoom-in">
</a>
{{- end -}}
{{- end -}}
</div>
<div class="col-lg-6 mb-3">
<h5 class="created text-muted text-uppercase font-weight-bold">{{ $page.Date.Format "January 2, 2006" }}</h5>
<h2><a href="{{ $page.RelPermalink }}">{{ $page.Title }}</a></h2>
<div class="content">
{{ $page.Summary }}
</div>
</div>
</div>
{{- end -}}
<!-- Articles -->
<div class="articles row row-cols-1 row-cols-lg-3">
{{ range after 1 (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) }}
<div class="col mb-3" data-aos="zoom-in">
{{ .Render "card" }}
</div>
{{ end }}
</div>
</div>
</main>
{{ end }}

View File

@@ -0,0 +1,39 @@
{{- if .Params.authors -}}
<ul class="authors list-inline">
{{- range .Params.authors -}}
{{- with $.Site.GetPage (printf "/authors/%s" (. | urlize)) -}}
{{- $term := . -}}
<li class="list-inline-item mr-3">
<div class="media author">
{{- if $term.Params.images -}}
{{- with .Resources.GetMatch (index $term.Params.images 0) -}}
{{- $image := .Resize "64x" -}}
{{- $2ximage := .Resize "128x q100" -}}
{{- $3ximage := .Resize "192x q100" -}}
<a href="{{ $term.RelPermalink }}" class="mr-3">
<picture>
<source srcset="{{ $image.RelPermalink }} 1x, {{ $2ximage.RelPermalink }} 2x, {{ $3ximage.RelPermalink }} 3x">
<img src="{{ $image.RelPermalink }}" class="rounded-circle" alt="{{ $term.Params.name }}">
</picture>
</a>
{{- end -}}
{{- end -}}
<div class="media-body">
<h5 class="name my-0">
{{ range $term.Params.name }}
{{ $name := . }}
<a href="{{ $term.RelPermalink }}" class="small">{{ $name }}</a>
{{ end }}
</h5>
{{- with $term.Params.twitter -}}
<p class="social small text-muted">
<a href="https://twitter.com/@{{ . | urlize }}">@{{ . }}</a>
</p>
{{- end -}}
</div>
</div>
</li>
{{- end -}}
{{- end -}}
</ul>
{{- end -}}

View File

@@ -0,0 +1,3 @@
<!-- Adding AOS -->
<link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
<!-- End AOS -->

View File

@@ -0,0 +1,21 @@
{{ with index .Site.Data "chunky-poster" }}
{{ range $vendor := .assets }}
{{ if $vendor.js }}
<script src="{{ print "dist/" $vendor.js | relURL }}"></script>
{{ end }}
{{ end }}
{{ end }}
{{ if .Site.Params.prismJS.enable }}
<script>
window.Prism = window.Prism || {};
window.Prism.manual = true;
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/components/prism-core.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/plugins/autoloader/prism-autoloader.min.js"></script>
{{ end }}
{{ range .Site.Params.customJS -}}
<script src="{{ "js/" | relURL }}{{ . }}"></script>
{{ end }}

View File

@@ -0,0 +1,58 @@
<footer class="footer text-center bg-dark py-4" style="z-index: 10;">
<div class="container">
<div class="row">
<div class="col">
<ul class="list-inline">
{{ if .Site.Params.social.rss -}}
<li class="list-inline-item">
{{- with .Site.GetPage "" -}}
{{- with .OutputFormats.Get "RSS" -}}
<a href="{{ .Permalink }}" rel="alternate" type="application/rss+xml" class="icons d-block">
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-rss fa-stack-1x fa-inverse"></i>
</span>
</a>
{{- end -}}
{{- end -}}
</li>
{{- end -}}
{{- if .Site.Params.social.email -}}
<li class="list-inline-item">
<a href="mailto:{{ .Site.Params.social.email }}" class="icons d-block">
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-envelope fa-stack-1x fa-inverse"></i>
</span>
</a>
</li>
{{- end -}}
{{- range $name, $path := .Site.Params.social -}}
{{- if and $path (not (in (slice "rss" "email") $name)) -}}
<li class="list-inline-item">
<a href="{{ $path | safeURL }}" class="icons d-block">
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fab fa-{{ $name }} fa-stack-1x fa-inverse"></i>
</span>
</a>
</li>
{{- end -}}
{{- end }}
</ul>
<p class="text-muted">
{{ if .Site.Copyright }}
{{ .Site.Copyright | safeHTML }}
{{ else }}
Copyright &copy; {{ .Site.Title }} {{ now.Year }}
{{ end }}
</p>
<!-- <p class="text-muted">
Powered by <a href="https://gohugo.io" target="_blank">Hugo</a> with <a href="https://github.com/puresyntax71/hugo-theme-chunky-poster" target="_blank">Chunky Poster</a>.
</p> -->
</div>
</div>
</div>
</footer>

165
layouts/partials/head.html Normal file
View File

@@ -0,0 +1,165 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title itemprop="name">
{{- block "title" . -}}
{{- with .Params.Title -}} {{ . }} | {{ end }}
{{- .Site.Title -}}
{{- end -}}
</title>
<!-- Set dynamic title for metadata -->
{{ $scratch := newScratch }}
{{ with .Params.Title }}
{{ $scratch.Set "title" . }}
{{ $scratch.Add "title" " | " }}
{{ end }}
{{ $scratch.Add "title" .Site.Title }}
<meta property="og:title" content={{ $scratch.Get "title" }} />
<meta name="twitter:title" content={{ $scratch.Get "title" }} />
<meta itemprop="name" content={{ $scratch.Get "title" }} />
<meta name="application-name" content={{ $scratch.Get "title" }} />
<meta property="og:site_name" content={{ .Site.Title }} />
<!-- Set description -->
{{ if .Description }}
{{ $scratch.Set "description" .Description}}
{{ else if .Site.Params.description }}
{{ $scratch.Set "description" .Site.Params.description }}
{{ end }}
<meta name="description" content={{ $scratch.Get "description" }} />
<meta itemprop="description" content={{ $scratch.Get "description" }} />
<meta property="og:description" content={{ $scratch.Get "description" }} />
<meta name="twitter:description" content={{ $scratch.Get "description" }} />
<!-- Set link -->
<base href="{{ .Permalink }}">
<link rel="canonical" href="{{ .Permalink }}" itemprop="url" />
<meta name="url" content="{{ .Permalink }}" />
<meta name="twitter:url" content="{{ .Permalink }}" />
<meta property="og:url" content="{{ .Permalink }}" />
<!-- Set language -->
<meta property="og:locale" content="{{ .Language.Lang }}">
<meta name="language" content="{{ .Site.Params.LanguageName }}">
{{ range .AllTranslations }}
<link rel="alternate" hreflang="{{ .Language.Lang }}" href="{{ .Permalink }}" title="{{ .Language.LanguageName }}">
{{ end }}
<!-- Set image -->
{{ with .Params.images }}
{{ $image := index . 0 }}
<meta itemprop="image" content="{{ $image | absURL }}" />
<meta property="og:image" content="{{ $image | absURL }}" />
<meta name="twitter:image" content="{{ $image | absURL }}" />
<meta name="twitter:image:src" content="{{ $image | absURL }}" />
{{ else }}
<meta itemprop="image" content="{{ .Site.Params.homepageimage | absURL }}" />
<meta property="og:image" content="{{ .Site.Params.homepageimage | absURL }}" />
<meta name="twitter:image" content="{{ .Site.Params.homepageimage | absURL }}" />
<meta name="twitter:image:src" content="{{ .Site.Params.homepageimage | absURL }}" />
{{ end }}
<!-- Set date -->
<meta property="og:updated_time" content={{ .Lastmod.Format "2006-01-02T15:04:05Z0700" | safeHTML }} />
<!-- Sitemap & RSS Feed Tags -->
<link rel="sitemap" type="application/xml" title="Sitemap" href="{{ .Site.BaseURL }}sitemap.xml" />
{{ with .OutputFormats.Get "RSS" }}
<link href="{{ .Permalink }}" rel="alternate" type="application/rss+xml" title="{{ $.Site.Title }}" />
<link href="{{ .Permalink }}" rel="feed" type="application/rss+xml" title="{{ $.Site.Title }}" />
{{ end }}
<!-- Set tags for article pages -->
{{ if eq .Section "post" }}
<!-- Pagination meta tags for list pages only -->
{{ $paginator := .Paginate (where .Pages "Section" "post") }}
{{ if $paginator }}
<link rel="first" href="{{ $paginator.First.URL }}">
<link rel="last" href="{{ $paginator.Last.URL }}">
{{ if $paginator.HasPrev }}
<link rel="prev" href="{{ $paginator.Prev.URL }}">
{{end }}
{{ if $paginator.HasNext }}
<link rel="next" href="{{ $paginator.Next.URL }}">
{{end }}
{{end }}
<meta property="og:type" content="article" />
<meta property="article:publisher" content="{{ .Site.Params.facebook }}" />
<meta property="og:article:published_time" content={{ .Date.Format "2006-01-02T15:04:05Z0700" | safeHTML }} />
<meta property="article:published_time" content={{ .Date.Format "2006-01-02T15:04:05Z0700" | safeHTML }} />
{{ if .Params.authors }}
{{ $authors := delimit .Params.authors ", " }}
<meta property="og:article:author" content="{{ $authors }}" />
<meta property="article:author" content="{{ $authors }}" />
<meta name="author" content="{{ $authors }}" />
{{ else }}
{{ $authors := .Site.Params.author }}
<meta property="og:article:author" content="{{ $authors }}" />
<meta property="article:author" content="{{ $authors }}" />
<meta name="author" content="{{ $authors }}" />
{{ end }}
{{ end }}
<!-- Set tags for single pages -->
{{ if ne .Section "post" }}
<meta property="og:type" content="website" />
<meta name="author" content="{{ .Site.Params.author }}" />
{{ end }}
<!-- Set favicon tags -->
<link rel="shortcut icon" href="{{ "favicon.ico" | absURL }}" />
<link rel="icon" type="image/x-icon" sizes="16x16 32x32" href="{{ "favicon.ico" | absURL }}" />
<link rel="apple-touch-icon" href="{{ "apple-touch-icon.png" | absURL }}" sizes="180x180">
<link rel="icon" href="{{ "favicon-32x32.png" | absURL }} " sizes="32x32" type="image/png">
<link rel="icon" href="{{ "favicon-16x16.png" | absURL }}" sizes="16x16" type="image/png">
<link rel="manifest" href="{{ "manifest.json" | absURL }}">
<link rel="mask-icon" href="{{ "safari-pinned-tab.svg" | absURL }}" color="#0c344b">
<!-- Set search engine tags -->
<meta name="robots" content="index,follow" />
<meta name="googlebot" content="index,follow" />
<!-- Set other tags -->
<meta name="keywords" content="" />
<meta name="imagemode" content="force" />
<meta name="coverage" content="Worldwide" />
<meta name="distribution" content="Global" />
<meta name="HandheldFriendly" content="True" />
<meta name="msapplication-tap-highlight" content="no" />
<meta name="apple-mobile-web-app-title" content="{{ .Site.Params.header }}" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="apple-touch-fullscreen" content="yes" />
{{ if .Site.Params.prismJS.enable }}
{{ if .Site.Params.prismJS.theme }}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/themes/prism-{{ .Site.Params.prismJS.theme }}.min.css">
{{ else }}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/themes/prism.min.css">
{{ end }}
{{ end }}
{{ with index .Site.Data "chunky-poster" }}
{{ range $vendor := .assets }}
{{ if $vendor.css }}
<link rel="stylesheet" href="{{ print "dist/" $vendor.css | relURL }}">
{{ end }}
{{ end }}
{{ end }}
{{ range .Site.Params.customCSS -}}
<link rel="stylesheet" href="{{ "css/" | relURL }}{{ . }}">
{{ end }}
<!-- <link rel="canonical" href="{{ .Permalink }}"> -->
{{- with .OutputFormats.Get "RSS" }}
<link href="{{ .Permalink }}" rel="alternate" type="application/rss+xml" title="{{ $.Site.Title }}">
<link href="{{ .Permalink }}" rel="feed" type="application/rss+xml" title="{{ $.Site.Title }}">
{{- end -}}
{{- template "_internal/opengraph.html" . -}}
{{- template "_internal/google_news.html" . -}}
{{- template "_internal/schema.html" . -}}
{{- template "_internal/twitter_cards.html" . -}}

View File

@@ -0,0 +1,26 @@
{{ $current := . }}
<nav class="navbar navbar-expand-md navbar-light bg-light fixed-top" id="navbar-main-menu">
<div class="container">
<a class="navbar-brand" href="{{ .Site.BaseURL }}"><img src="/images/DUCK_256.png" width="30" height="30" class="mr-3 rotate-a-20"/>{{ .Site.Title }}</a>
<!-- <a class="navbar-brand font-weight-bold" href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a> -->
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#main-menu" aria-controls="main-menu" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="main-menu">
<ul class="navbar-nav ml-auto">
{{- if .Site.Params.showLanguageSwitcher -}}
{{ partial "i18nlist.html" . }}
{{- end -}}
{{ with .Site.Menus.main }}
{{ range . }}
<li class="nav-item{{ if $current.IsMenuCurrent "main" . }} active{{ end }}"><a class="nav-link" href="{{ .URL | relLangURL }}">{{ .Name }}</a></li>
{{ end }}
{{ end }}
<li class="nav-item">
<i class="fas fa-search" data-fa-transform="down-5"></i>
</li>
</ul>
</div>
</div>
</nav>

View File

@@ -0,0 +1,6 @@
{{ if .IsTranslated }}
{{ range .Translations }}
<li class="nav-item"><a class="nav-link" href="{{ .Permalink }}">{{ .Lang }}</a>
</li>
{{ end}}
{{ end }}

9
layouts/partials/js.html Normal file
View File

@@ -0,0 +1,9 @@
<!-- Adding AOS -->
<script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
<script>
AOS.init({
duration: 1000,
once: false,
});
</script>
<!-- Finish AOS -->

View File

@@ -0,0 +1,10 @@
{{- $related := .Site.RegularPages.Related . | first 3 -}}
{{- with $related -}}
<div class="related-content row mt-5 row-cols-1 row-cols-lg-3">
{{- range . -}}
<div class="col mb-3">
{{ .Render "card" }}
</div>
{{- end -}}
</div>
{{- end -}}

View File

@@ -0,0 +1,40 @@
<script type="application/ld+json">
[
{{- if eq .Section "post" }}
{
"@context": "https://schema.org",
"@type": "BlogPosting",
"headline": {{ .Title }},
"image": {{ index .Params.images 0 | absURL }},
"datePublished": {{ .PublishDate }},
"dateModified": {{ .Lastmod }},
"wordCount": {{ .WordCount }},
"author": {
"@type": "Person",
"name": {{ .Site.Params.author }}
},
"mainEntityOfPage": { "@type": "WebPage" },
"publisher": {
"@type": "Organization",
"name": {{ .Site.Params.header }},
"logo": {
"@type": "ImageObject",
"url": {{ .Site.Params.logo | absURL }}
}
},
"description": {{ .Summary | plainify | safeHTML }},
"keywords": [{{ range $i, $e := .Params.tags }}{{ if $i }}, {{ end }}{{ $e }}{{ end }}]
},
{{- end }}
{
"@context": "https://schema.org",
"@type": "Organization",
"name": {{ .Site.Params.header }},
"url": {{ .Site.BaseURL }},
"sameAs": [
"https://twitter.com/{{ .Site.Params.twitter }}",
"https://github.com/{{ .Site.Params.github }}"
]
}
]
</script>

View File

@@ -0,0 +1,24 @@
{{- if and .Site.Params.share (ne .Params.share false) -}}
<ul class="share nav my-3 justify-content-end">
<li class="nav-item">
<a class="nav-link" target="_blank" href="https://twitter.com/intent/tweet?url={{ .Permalink | htmlEscape }}&text={{ .Title | htmlEscape }}">
<i class="fa-fw fab fa-twitter"></i>
</a>
</li>
<li class="nav-item">
<a class="nav-link" target="_blank" href="https://www.linkedin.com/shareArticle?url={{ .Permalink | htmlEscape }}&title={{ .Title | htmlEscape }}">
<i class="fa-fw fab fa-linkedin-in"></i>
</a>
</li>
<li class="nav-item">
<a class="nav-link" target="_blank" href="https://www.facebook.com/sharer.php?u={{ .Permalink | htmlEscape }}&t={{ .Title | htmlEscape }}">
<i class="fa-fw fab fa-facebook-f"></i>
</a>
</li>
<li class="nav-item">
<a class="nav-link" target="_blank" href="https://reddit.com/submit?url={{ .Permalink | htmlEscape }}&title={{ .Title | htmlEscape }}">
<i class="fa-fw fab fa-reddit-alien"></i>
</a>
</li>
</nav>
{{- end -}}

18
layouts/post/card.html Normal file
View File

@@ -0,0 +1,18 @@
<div class="card h-100" data-aos="zoom-in">
{{ $page := . }}
<a href="{{ $page.RelPermalink }}" class="d-block">
{{- with .Resources.Match "images/banner.svg" -}}
{{ range . }}
{{- $image := . -}}
<img data-src="{{ $image.RelPermalink }}" class="card-img-top mx-auto d-block pt-2" alt="{{ $page.Title }}">
{{- end -}}
{{- end -}}
<div class="card-body">
<h4 class="card-title">{{ $page.Title }}</h4>
<p class="card-text text-muted text-uppercase">{{ $page.Date.Format "January 2, 2006" }}</p>
<div class="card-text">
{{ $page.Summary | plainify }}
</div>
</div>
</a>
</div>

75
layouts/post/single.html Normal file
View File

@@ -0,0 +1,75 @@
{{ define "main" }}
<main class="content-page container pt-7 pb-5">
{{ $page := . }}
<div class="row">
<div class="col">
<article>
<div class="row justify-content-center">
<div class="col-lg-8">
<div class="meta text-muted mb-3">
<p class="created text-muted text-uppercase font-weight-bold mb-1">{{ $page.Date.Format "January 2, 2006" }}</p>
<span class="mr-2"><i class="fas fa-book-open mr-2"></i>{{ T "wordCount" $page.WordCount }}</span>
<span><i class="fas fa-clock mr-2"></i>{{ T "readingTime" $page.ReadingTime }}</span>
</div>
<h1>{{ $page.Title }}</h1>
{{ partial "authors.html" $page }}
</div>
</div>
{{- with .Resources.Match "images/banner.svg" -}}
{{ range . }}
<div class="row justify-content-center mb-3">
<div class="col-lg-10">
<img data-src="{{ .RelPermalink }}" class="img-fluid rounded mx-auto d-block" alt="{{ $page.Title }}" data-aos="zoom-in">
</div>
</div>
{{- end -}}
{{- end -}}
{{- with $page.Params.tags -}}
<div class="row justify-content-center">
<div class="col-lg-8">
<div class="tags my-3">
{{- range . -}}
<a class="badge badge-pill badge-light border mr-2" href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">
<i class="fas fa-tag mr-2"></i>{{ . }}
</a>
{{- end -}}
</div>
</div>
</div>
{{- end -}}
<div class="row justify-content-center">
<div class="col-lg-8">
<div class="content">
{{ $page.Content }}
</div>
{{ partial "sharer.html" . }}
</div>
</div>
<div class="row justify-content-center">
<div class="col-lg-8">
{{ template "_internal/disqus.html" . }}
</div>
</div>
{{- if .Site.Params.commento.enable -}}
<div class="row justify-content-center my-3">
<div class="col-lg-8">
<div id="commento"></div>
<script src="{{ .Site.Params.commento.url }}"></script>
</div>
</div>
{{- end -}}
</article>
</div>
</div>
{{ partial "related.html" $page }}
</main>
{{ end }}

100
layouts/search/single.html Normal file
View File

@@ -0,0 +1,100 @@
{{ define "main" }}
<main class="content-page container pt-7 pb-5">
<div class="container">
<div class="row">
<div class="col">
{{ .Content }}
</div>
</div>
<div class="row">
<div class="col">
<div class="search-input-wrap">
<form id="search-form" method="get" action="">
<input id="search" name="q" type="text" />
<br>
<button id="search-button" type="submit" class="button">Search</button>
<a id="search-clear" href="/search/">Clear</a>
</form>
</div>
<br>
<div id="app-search" class="row listrecent"></div>
</div>
</div>
<div id="app-search" class="row listrecent"></div>
<script src="{{ .Site.BaseURL }}js/lunr.js"></script>
<div class="row">
{{ $p := slice }}
{{ range (where .Site.RegularPages "Section" "==" "post") }}
{{ $.Scratch.Set "image" .RelPermalink }}
{{ $.Scratch.Add "image" (index .Params.images 0) }}
{{ $post := dict "link" .RelPermalink "author" (index .Params.authors 0) "tags" .Params.tags "title" .Title "date" (.Params.date.Format "January 2, 2006") "image" ($.Scratch.Get "image") "content" (substr .Plain 0 200) -}}
{{ $p = $p | append $post -}}
{{ end }}
{{ $p | jsonify }}
</div>
<script>
const posts = JSON.parse(
{{ $p | jsonify }}
);
const query = new URLSearchParams(window.location.search);
const searchString = query.get('q');
document.querySelector('#search').value = searchString;
const $target = document.querySelector('#app-search');
// Our index uses title as a reference
const postsByTitle = posts.reduce((acc, curr) => {
acc[curr.title] = curr;
return acc;
}, {});
fetch('/search-index.json').then(function (res) {
return res.json();
}).then(function (data) {
const index = lunr.Index.load(data);
const matches = index.search(searchString);
const matchPosts = [];
matches.forEach((m) => {
matchPosts.push(postsByTitle[m.ref]);
});
matchPosts[0].tags.forEach(p => {console.log(p)})
console.log(matchPosts[0].tags)
try {
$target.innerHTML = matchPosts.map(p => {
return `<br><div class="col-lg-4 col-md-6 mb-30px card-group">
<div class="card h-100">
<div class="maxthumb">
<a href="${p.link}">
<img class="img-fluid" src="${p.image}" alt="An thumbnail image.">
</a>
</div>
<div class="card-body">
<h2 class="card-title"><a class="text-dark" href="${p.link}">${p.title}</a></h2>
<h5 class="card-text">${p.content}...</h5>
</div>
<div style="padding-right: 10px; padding-left: 10px;" class=>
${
p.tags.map(function (tag) {
return "<span style='white-space: nowrap;'>" + '<i class="fas fa-tag mr-2" style="margin-right: 4px !important; font-size: 0.8em !important;"></i>' + tag + " </span>"}).join('')
}
</div>
<div class="wrapfooter">
<span class="author-meta">
<span class="post-name"><a href="/author/${p.authorurlized}">${p.author}</a></span><br/>
<span class="post-date">${p.date}</span>
</span>
</div>
</div>
</div>
</div>`;
}).join('');
} catch(TypeError) {
$target.innerHTML = `<div>No search results found.</div>`;
console.error(TypeError)
}
});
</script>
</div>
</main>
{{ end }}

View File

@@ -0,0 +1,27 @@
<figure class="figure{{ with .Get "class" }} {{ . }}{{ end }}">
<a href="{{ .Get "src" }}" class="d-block" data-toggle="lightbox" data-gallery="post-gallery">
<img src="{{ .Get "src" }}"
{{- if or (.Get "alt") (.Get "caption") }}
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
{{- end -}}
{{- with .Get "width" }} width="{{ . }}"{{ end -}}
{{- with .Get "height" }} height="{{ . }}"{{ end -}}
class="figure-img img-fluid"
/> <!-- Closing img tag -->
</a>
{{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}}
<figcaption class="figure-caption text-center">
{{ with (.Get "title") -}}
{{ . }}
{{- end -}}
{{- if or (.Get "caption") (.Get "attr") -}}<p>
{{- .Get "caption" | markdownify -}}
{{- with .Get "attrlink" }}
<a href="{{ . }}">
{{- end -}}
{{- .Get "attr" | markdownify -}}
{{- if .Get "attrlink" }}</a>{{ end }}</p>
{{- end }}
</figcaption>
{{- end }}
</figure>

View File

@@ -0,0 +1,5 @@
{{ $img := $.Page.Resources.GetMatch (.Get 0)}}
<figure>
<img src="{{ $img.RelPermalink }}" alt="(.Get 1)" />
<figcaption>{{.Get 1}}</figcaption>
</figure>

View File

@@ -0,0 +1,10 @@
<div class="card h-100" data-aos="zoom-in">
{{ $page := . }}
{{ range $name, $taxonomy := .Site.Taxonomies.tags }}
<a href="{{ $page.RelPermalink }}" class="d-block">
<div class="card-body">
<h4 class="card-title"><i class="fas fa-tag mr-2"></i>{{ $name }}</h4>
</div>
</a>
{{ end }}
</div>

30
layouts/tags/terms.html Normal file
View File

@@ -0,0 +1,30 @@
{{ define "main" }}
<main class="list container py-6">
{{- if or .Title .Content -}}
<div class="row py-3">
<div class="col">
{{ with .Title }}<h3 class="display-4">{{ . }}</h3>{{ end }}
{{- with .Content -}}
<div class="content">
{{ . }}
</div>
{{- end -}}
</div>
</div>
{{- end -}}
<div class="row row-cols-1 row-cols-lg-3">
{{ range $name, $taxonomy := .Site.Taxonomies.tags }}
<div class="col">
<a href="{{ $.Site.BaseURL }}tags/{{ $name }}" style="text-decoration: none;">
<div class="card h-100" data-aos="zoom-in">
<div class="card-body" data-aos="zoom-in">
<h4 class="card-title" style="margin-bottom: 0px; "><i class="fas fa-tag mr-2"></i>[{{ len $taxonomy }}] {{ $name }}</h4>
</div>
</div>
</a>
</div>
{{ end }}
</div>
</main>
{{ end }}