Copying layouts from old theme to new

This commit is contained in:
2020-05-31 05:21:00 +01:00
parent 3503ec15d8
commit 9dbf2d80d7
28 changed files with 882 additions and 0 deletions

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,12 @@
{{ with index .Site.Data "panaetius-theme" }}
{{ range $vendor := .assets }}
{{ if $vendor.js }}
<script src="{{ print "dist/" $vendor.js | relURL }}"></script>
{{ end }}
{{ end }}
{{ 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 "panaetius-theme" }}
{{ 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 -}}