Initialisierung

This commit is contained in:
mdn 2022-11-13 20:52:45 +01:00
parent 4084518848
commit 6dd9fa38f6
116 changed files with 17349 additions and 2 deletions

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">
{{- partial "head.html" . -}}
<body>
<div class="container">
{{- partial "header.html" . -}}
{{- block "head" . -}}{{- end }}
<div class="row g-5">
<div id="content" class="col-md-8">
{{- block "main" . -}}{{- end }}
</div>
<div id="sidebar" class="col-md-4">
{{- block "sidebar" . -}}{{- end }}
</div>
</div>
{{- partial "footer.html" . -}}
{{- partial "script.html" . -}}
</div>
</body>
</html>

View file

@ -0,0 +1,70 @@
{{ define "main" }}
<h1>{{ .Title }}</h1>
{{ range .Pages.ByPublishDate.Reverse }}
<p>
<h3><a class="title" href="{{ .RelPermalink }}">{{ .Title }}</a></h3>
{{ partial "metadata.html" . }}
<a class="summary" href="{{ .RelPermalink }}">
<p>{{ .Summary }}</p>
</a>
</p>
{{ end }}
{{ end }}
{{ define "sidebar" }}
<div class="position-sticky" style="top: 2rem;">
<div class="p-4 mb-3 bg-light rounded">
<h4 class="py-1 mb-3 fst-italic text-bg-dark text-center">About Me</h4>
{{ with .Site.Params.Avatar }}
<div class="py-1 text-center">
<img class="rounded-circle" src="{{ . }}" alt="Ansprechendes Bild"/>
</div>
{{ end }}
<!-- Über config beschreibbar machen -->
{{ with .Site.Params.Description }}
<div class="py-1">
{{ . }}
</div>
{{ end }}
<h4 class="py-1 mb-3 fst-italic text-bg-dark text-center">Contact Me</h4>
<div class="py-1 social">
<ul class="social-links">
{{ with .Site.Params.Social.Email }}
<li><a href="mailto:{{ . }}"><i data-feather="mail"></i>&nbsp;{{ . }}</a></li>
{{ end }}
{{ with .Site.Params.Social.Phone }}
<li><a href="tel:{{ . }}"><i class="bi" data-feather="phone"></i>&nbsp;{{ . }}</a></li>
{{ end }}
{{ with .Site.Params.Social.VoIP }}
<li><a href="sip:{{ . }}"><i data-feather="phone"></i>&nbsp;{{ . }}</a></li>
{{ end }}
{{ with .Site.Params.Social.Github }}
<li><a href="https://github.com/{{ . }}" target="_blank"><i data-feather="github"></i>&nbsp;{{ . }}</a></li>
{{ end }}
{{ with .Site.Params.Social.Twitter }}
<li><a href="https://twitter.com/{{ . }}" target="_blank"><i class="bi" data-feather="twitter"></i>&nbsp;{{ . }}</a></li>
{{ end }}
{{ with .Site.Params.Social.LinkedIn }}
<li><a href="https://linkedin.com/in/{{ . }}" target="_blank"><i class="bi" data-feather="linkedin"></i>&nbsp;{{ . }}</a></li>
{{ end }}
{{ with .Site.Params.Social.Matrix }}
<li><a href="https://matrix.to/#/{{ . }}" target="_blank"><img src="/img/matrix-badge.svg" alt="Chat on matrix">&nbsp;{{ . }}</a></li>
{{ end }}
{{ with .Site.Params.Social.RSS }}
<li><a href="{{ . }}"><i class="bi" data-feather="rss"></i>&nbsp;RSS</a></li>
{{ end }}
</ul>
</div>
<!-- Hier die Links zu Mail usw. vielleicht auch zum SIP Anschluss, vielleicht mit dem Icons aus faether oder Bootstrap -->
</div>
</div>
{{ end }}

View file

@ -0,0 +1,6 @@
{{ define "main" }}
<h1>{{ .Title }}</h1>
{{ partial "metadata.html" . }}
<br/><br/>
{{ .Content }}
{{ end }}

109
layouts/blog/list.html Normal file
View file

@ -0,0 +1,109 @@
{{ define "head" }}
{{ if eq .Type "blog" }}
{{ $latestEntry := index (where (where .Site.RegularPages "Type" "blog") "Params.featured" true).ByPublishDate.Reverse 0 }}
<div class="p-4 p-md-5 m-2 mb-4 rounded text-bg-dark">
<div class="col-md6 px-0">
<h1 class="display-4 fst-italic">{{ $latestEntry.Title }}</h1>
<p class="lead my-3">{{ $latestEntry.Summary }}</p>
<p class="lead mb-0"><a href="{{ $latestEntry.Permalink }}" class="text-white fw-bold">Weiter lesen...</a></p>
</div>
</div>
{{ end }}
{{ end }}
{{ define "main" }}
{{/* Paginator initialisieren, in der Reihenfolge die man sich im Blog wünscht */}}
{{ if eq .Type "blog" }}
{{/* Der 1te Weg soll alle Blog-Einträge finden*/}}
{{ $pag := .Paginate (where .Site.RegularPages "Type" "blog").ByPublishDate.Reverse 3 }}
{{ else }}
{{/* Der 2te Weg ist über die Archive-Gruppierung, und dort wird nicht paginiert */}}
{{ $pag := .Paginate .Pages.ByPublishDate.Reverse 9999 }}
{{ end }}
{{/* Der Paginator wurde in den If-Blöcken zwar erstellt, aber die Variable ist auserhalb nicht sichtbar, daher hier explizit holen.
Dieser kann nach dem ersten erstellen auch nicht mehr verändert werden */}}
{{ $pag := .Paginator }}
<h1>{{ .Title }}</h1>
{{ range $pag.Pages }}
<article class="blog-post">
<h2 class="blog-post-title mb-1"><a href="{{ .RelPermalink }}">{{ .Title }}</a></h2>
<p class="blog-post-meta">{{ partial "metadata.html" . }}</p>
<p>{{ .Summary }}</p>
</article>
{{ end }}
{{ template "partials/pagination.html" . }}
{{ end }}
{{ define "sidebar" }}
<div class="position-sticky blog-sidebar" style="top: 2rem;">
<div class="p-4">
{{/* range $tax := .Site.Params.Blog.Taxonomies }}
{{ $taxUrl := $.Site.GetPage (printf "/%s" $tax) }}
<h4 class="fst-italic"><a href="{{- $taxUrl.Permalink -}}">{{ $tax }}</a></h4>
<ul class="mb-2">
{{ $parentLink := (printf "/%s/" $tax) }}
{{ $x := (index $.Site.Taxonomies "tags") }}
{{ range (index $.Site.Taxonomies $tax) }}
{{ printf "%#v" . }}
<li><a href="{{/* (printf "%s%s" $parentLink $key) * /}}">{{/* $key * /}}</a></li>
{{ end }}
</ul>
{{ end */}}
{{ $catIdent := .Site.Params.Blog.Categories | default "categories" }}
{{ $cats := (index $.Site.Taxonomies $catIdent)}}
{{ if $cats }}
<h4 class="fst-italic">Kategorien</h4>
<ul class="mb-2">
{{ $parentLink := ($.Site.GetPage (printf "/categories")).Permalink }}
{{ range $key, $sites := $cats }}
<li><a href="{{ (printf "%s%s" $parentLink $key) }}">{{ $key }}</a>&nbsp;<small>({{ $sites.Count }})</small></li>
{{ end }}
</ul>
{{ end }}
{{/* https://mertbakir.gitlab.io/hugo/tag-cloud-in-hugo/ */}}
{{ $tagsIdent := .Site.Params.Blog.Tags | default "tags" }}
{{ $tags := (index $.Site.Taxonomies $tagsIdent)}}
{{ if $tags }}
<h4 class="fst-italic">Schlagwortwolke</h4>
<div class="tag-cloud">
{{ $parentLink := ($.Site.GetPage (printf "/%s" $tagsIdent)).Permalink }}
{{ $maxCnt := mul 1.0 (index $tags.ByCount 0).Count }}
{{ $minCnt := mul 1.0 (index $tags.ByCount.Reverse 0).Count }}
{{ $div := math.Max 1 (sub $maxCnt $minCnt) }}
{{ range $key, $sites := $tags }}
<!-- add (mul (math.Pow (div $sites.Count $maxCnt) 2.0) 14.0) 8.0 px -->
<a class="tag-cloud-link" style="{{ printf "font-size: %.3frem" (add (mul (math.Pow (div (sub $sites.Count $minCnt) $div) 2.0) 0.4) 1.0) }};" href="{{ $parentLink | relURL }}{{ $key | urlize }}" aria-label="{{- $key -}} ({{- $sites.Count -}} Einträge)">
{{- $key -}}<sup>{{ $sites.Count }}</sup>
</a>
<!--<span class="badge">{{ $sites.Count }}</span>-->
{{ end }}
</div>
{{ end }}
{{/* range $taxonomy_term, $taxonomy := .Site.Taxonomies }}
{{ with $.Site.GetPage (printf "/%s" $taxonomy_term) }}
<h4 class="fst-italic"><a class="text-decoration-none" href="{{ .Permalink }}">{{ $taxonomy_term }}</a></h4>
<ul class="mb-2">
{{ $parentLink := .Permalink }}
{{ range $key, $sites := $taxonomy }}
<li><a href="{{ (printf "%s%s" $parentLink $key) }}">{{ $key }}</a></li>
{{ end }}
</ul>
{{ end }}
{{ end */}}
<h4 class="fst-italic">Archive</h4>
<ul class="mb-2">
{{/* Hier explizit auf Type achten!! */}}
{{ range (where .Site.RegularPages "Type" "blog").GroupByDate "2006" }}
<li><a href="/blog/{{ .Key }}">Year {{ .Key }}</a></li>
{{ end }}
</ul>
</div>
</div>
{{ end }}

25
layouts/blog/single.html Normal file
View file

@ -0,0 +1,25 @@
{{ define "main" }}
<section class="section">
<article>
<div class="columns is-centered">
<div class="column">
<h1 class="title is-1">{{ .Title }}</h1>
<div class="blog-post-meta">{{ partial "metadata.html" . }}</div>
<div class="content">
{{ .Content }}
</div>
<div class="blog-post-meta mt-5">{{ partial "metafooter.html" . }}</div>
</div>
</div>
</article>
</section>
{{ end }}
{{ define "sidebar" }}
<aside class="position-sticky" style="top: 2rem;">
<div class="p-4">
{{ .TableOfContents }}
</div>
</aside>
{{ end }}

5
layouts/index.html Normal file
View file

@ -0,0 +1,5 @@
{{ define "main" }}
<div id="home-jumbotron" class="jumbotron text-center bg-light">
<h1 class="title">{{ .Site.Title }}</h1>
</div>
{{ end }}

View file

@ -0,0 +1,8 @@
<footer class="footer bg-dark text-white">
<nav class="nav justify-content-center navbar-expand-md navbar-dark ">
<a class="nav-link" href="#">Impressum & Datenschutz</a>
<a class="nav-link" href="#">RSS-Feed</a>
</nav>
<p><a class="nav-link" href="#"><small>&copy; 2009-{{ now.Format "2006"}} MarcoDN</small></a></p>
</footer>

View file

@ -0,0 +1,24 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, intial-scale=1">
<meta name="author" content="{{ .Site.Params.Author }}">
{{ $title := print .Site.Title " | " .Title }}
{{ if .IsHome }}{{ $title := .Site.Title }} {{ end }}
<title>{{ $title }}</title>
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{ if .IsPage }}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}">
{{/* compressed soll besser sein als minify bei SASS */}}
{{ $sassOptions := (dict "targetPath" "main.css" "outputStyle" "compressed" "enableSourceMap" (not hugo.IsProduction) "includePaths" "assets/bootstrap/scss") }}
{{ $sassStyle := resources.Get "_own/sass/main.scss" | resources.ToCSS $sassOptions | minify }}
<link rel="stylesheet" type="text/css" href="{{ $sassStyle.RelPermalink | relURL }}">
{{ $style := resources.Match "_own/css/**.css" | resources.Concat "css/custom.css" | minify }}{{/* .Resources.GetMatch "css/**.css" */}}
<link rel="stylesheet" type="text/css" href="{{ $style.RelPermalink | relURL }}">
{{ if isset .Site.Params "custom_css" }}
{{ range .Site.Params.custom_css }}
<link rel="stylesheet" type="text/css" href="{{ $.Site.BaseURL }}{{ . }}">
{{ end }}
{{ end }}
</head>

View file

@ -0,0 +1,31 @@
<header class="fixed-top_" style="padding-bottom: 3px;">
<div class="px-3 py-2 text-bg-dark">
<div class="container">
<div class="d-flex flex-wrap align-items-center justify-content-center justify-content-lg-start">
<a href="/" class="d-flex align-items-center my-2 my-lg-0 me-lg-auto text-white text-decoration-none">
<!-- TODO Via SVG eigenes Icon vielleicht mal zeichnen wie bei Bootstrap mit MDN als Inhalt -->
<i class="bi me-2" data-feather="home"></i>
{{ if .IsHome }}
{{ print .Site.Title }}
{{ else }}
{{ print .Site.Title " | " .Title }}
{{ end }}
</a>
<nav id="nav" class="nav col-12 col-lg-auto my-2 justify-content-center my-md-0 text-small navbar-expand-md navbar-dark bg-dark">
{{ range .Site.Menus.main }}
<!-- text-secondary bei der aktiven Url sonst text-white -->
<a class="nav-link text-white" href="{{ .URL }}">
{{ if .Pre }}
{{ $icon := printf "<i class=\"bi d-block mx-auto mb-1\" data-feather=\"%s\"></i>" .Pre | safeHTML }}
{{ $icon }}
{{ end}}
{{ $text := print .Name | safeHTML }}
{{ $text }}
</a>
{{ end }}
</nav>
</div>
</div>
</div>
</header>

View file

@ -0,0 +1,8 @@
{{ $dateTime := .PublishDate.Format "2006-01-02" }}
{{ $dateTimeMod := .Lastmod.Format "2006-01-02" }}
{{ $dateFormat := .Site.Params.dateFormat | default "Jan 2, 2006" }}
<i data-feather="calendar"></i>
<time datetime="{{ $dateTime }}">{{ .PublishDate.Format $dateFormat }}</time>
<i data-feather="user"></i>
{{ .Page.Params.Author }}
<span class="badge bg-secondary"><time datetime="{{ $dateTimeMod }}">{{ .Lastmod.Format $dateFormat }}</time>)</span>

View file

@ -0,0 +1,20 @@
{{ with .Params.tags }}
<i data-feather="tag"></i>
<i class="bi bi-tag"></i> <!-- TODO: umstellen auf bootstrap-icons??? -->
{{ range . }}
{{ $href := print (absURL "tags/") (urlize .) }}
<a class="btn btn-sm btn-outline-dark tag-btn" href="{{ $href }}">{{ . }}</a>
{{ end }}
{{ end }}
&nbsp;
{{ with .Params.categories }}
<!-- list -->
<i data-feather="award"></i>
{{ range . }}
{{ $href := print (absURL "categories/") (urlize .) }}
<a class="btn btn-sm btn-outline-dark tag-btn" href="{{ $href }}">{{ . }}</a>
{{ end }}
{{ end }}

View file

@ -0,0 +1,37 @@
{{ $pag := $.Paginator }}
{{ if gt $pag.TotalPages 1 }}
{{ $.Scratch.Set "dot_rendered" false }}
<nav aria-label="page navigation">
<ul class="pagination">
<!-- Don't show on 1st and 2nd page -->
{{ if and (ne $pag.PageNumber 1) (ne $pag.PageNumber 2) }}
<li class="page-item"><a href="{{ $pag.First.URL }}" rel="first" class="page-link">&laquo;</a></li>
{{ end }}
{{ if $pag.HasPrev }}
<li class="page-item"><a href="{{ $pag.Prev.URL }}" rel="prev" class="page-link">&lsaquo;</a></li>
{{ end }}
{{ range $pag.Pagers }}
{{ if eq . $pag }} <!-- Current Page -->
<li class="page-item active"><a href="{{ .URL }}" class="page-link">{{ .PageNumber }}</a></li>
{{ else if and (ge .PageNumber (sub $pag.PageNumber 2)) (le .PageNumber (add $pag.PageNumber 2)) }}
{{ $.Scratch.Set "dot_rendered" false }} <!-- Render prev 2 page and next 2 pages -->
<li class="page-item"><a href="{{ .URL }}" class="page-link">{{ .PageNumber }}</a></li>
{{ else if eq ($.Scratch.Get "dot_rendered") false }} <!-- render skip pages -->
{{ $.Scratch.Set "dot_rendered" true }}
<li class="page-item disabled"><a class="page-link">...</a></li>
{{ end }}
{{ end }}
{{ if $pag.HasNext }}
<li class="page-item"><a href="{{ $pag.Next.URL }}" rel="next" class="page-link">&rsaquo;</a></li>
{{ end }}
<!-- Don't show on last and 2nd last page -->
{{ if and (ne $pag.PageNumber $pag.TotalPages) ((ne $pag.PageNumber (sub $pag.TotalPages 1))) }}
<li class="page-item"><a href="{{ $pag.Last.URL }}" rel="last" class="page-link">&raquo;</a></li>
{{ end }}
</ul>
</nav>
{{ end }}

View file

@ -0,0 +1,16 @@
{{ $bootstrapJs := resources.Get "bootstrap/js/bootstrap.bundle.min.js" }}
<script src="{{ $bootstrapJs.Permalink | relURL }}"></script>
{{ $featherJs := resources.Get "feather/js/feather.min.js" }}
<script src="{{ $featherJs.Permalink | relURL }}"></script>
{{ $mainJs := resources.Get "_own/js/main.js" | js.Build | minify }}
<script src="{{ $mainJs.Permalink | relURL }}"></script>
{{- range .Site.Params.custom_js -}}
<script src="{{ $.Site.BaseURL }}{{ . }}"></script>
{{ end }}
<script>
feather.replace();
</script>