Einbinden von CustomCSS setzt keine Site-Base mehr davor + kleinere Anpassungen um Leerzeilen zu vermeiden

This commit is contained in:
mdn 2023-01-22 00:47:23 +01:00
parent c14beceef6
commit 631c22e7c6
18 changed files with 134 additions and 146 deletions

View file

@ -2,22 +2,20 @@
<html lang="{{ .Site.LanguageCode }}">
{{- partial "head.html" . -}}
<body>
<!--<div classes="d-flex flex-column min-vh-100 vh-100">-->
{{- partial "header.html" . -}}
<main role="main" class="container-md flex-grow-1">
{{- block "head" . -}}{{- end }}
{{- partial "header.html" . -}}
<main role="main" class="container-md flex-grow-1">
{{- block "head" . -}}{{- end }}
<div class="row">
<div id="content" class="col-md-8 border rounded shadow-lg p-3 mb-2">
{{- block "main" . -}}{{- end }}
</div>
<div id="sidebar" class="col-md-4 px-3">
{{- block "sidebar" . -}}{{- end }}
</div>
<div class="row">
<div id="content" class="col-md-8 border rounded shadow-lg p-3 mb-2">
{{- block "main" . -}}{{- end }}
</div>
</main>
{{- partial "footer.html" . -}}
<!--</div>-->
<div id="sidebar" class="col-md-4 px-3">
{{- block "sidebar" . -}}{{- end }}
</div>
</div>
</main>
{{- partial "footer.html" . -}}
{{- partial "script.html" . -}}
</body>
</html>

View file

@ -8,9 +8,9 @@
{{- partial "widget/header.html" (dict "title" "About Me") -}}
{{- partial "widget/aboutme.html" (dict "avatar" .Site.Author.avatar "description" .Site.Author.description) -}}
{{ with .Site.Author.social }}
{{- with .Site.Author.social }}
{{- partial "widget/header.html" (dict "title" "Contact Me") -}}
{{- partial "widget/socials.html" . -}}
{{ end }}
{{ end -}}
</div>
{{ end }}

View file

@ -22,12 +22,12 @@
{{ end }}
{{ define "sidebar" }}
{{ if isset .Site.Author "linkdata" }}
{{ with (index .Site.Data .Site.Author.linkdata) }}
{{- if isset .Site.Author "linkdata" -}}
{{- with (index .Site.Data .Site.Author.linkdata) }}
<div class="position-sticky">
{{- partial "widget/header.html" (dict "title" "Links") -}}
{{- partial "widget/links.html" . -}}
</div>
{{ end }}
{{ end }}
{{ end }}
{{- end -}}
{{- end -}}
{{- end }}

View file

@ -1,36 +1,33 @@
<footer class="bg-dark text-bg-dark">
<nav class="nav justify-content-center navbar-expand-md navbar-dark ">
{{ with .Site.Params.Imprint }}
{{- with .Site.Params.Imprint }}
<a class="nav-link" href="{{- . -}}">Impressum</a>
{{ end }}
{{ with .Site.Params.Privacy }}
{{- end }}
{{- with .Site.Params.Privacy }}
<a class="nav-link" href="{{- . -}}">Datenschutz</a>
{{ end }}
{{ if (not .IsHome) }}
{{ with .OutputFormats.Get "rss" -}}
{{- end }}
{{- if (not .IsHome) }}
{{- with .OutputFormats.Get "rss" -}}
<a class="nav-link" href="{{- .Permalink | relURL -}}">RSS-Feed</a>
{{ end }}
{{ end }}
{{- end }}
{{- end }}
</nav>
<p>
{{ if (and (isset .Site.Params "githashfile") (isset .Site.Params "gitrepourl")) }}
{{ if (fileExists .Site.Params.gitHashFile) }}
{{ $commit_id := trim (readFile .Site.Params.gitHashFile) "\n" }}
{{- if (and (isset .Site.Params "githashfile") (isset .Site.Params "gitrepourl")) }}
{{- if (fileExists .Site.Params.gitHashFile) }}
{{- $commit_id := trim (readFile .Site.Params.gitHashFile) "\n" }}
Git commit:
<a class="border bg-light text-bg-light rounded px-1 me-1"
href="{{- .Site.Params.gitRepoUrl -}}/commit/{{- $commit_id -}}"
target="_blank">{{- substr $commit_id 0 7 -}}</a>
{{ end }}
{{ end }}
{{- end }}
{{- end }}
<small>Updated on {{ now.Format "January 2, 2006" }}</small>
</p>
<p>
{{ with .Site.Copyright }}
<a class="nav-link" href="#"><small>Webseite: &copy; {{- . -}}</small></a>
{{ end }}
{{- with .Site.Copyright }}
<a class="nav-link" href="#"><small>Webseite: &copy; {{- . -}}</small></a>
{{- end }}
<a class="nav-link" href="http://marcodn.de/"><small>Design: &copy; 2009-{{ now.Format "2006"}} MarcoDN</small></a>
</p>
</footer>

View file

@ -3,26 +3,24 @@
<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 }}
{{- $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 }}
{{- $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" */}}
{{- $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" }}
{{- if isset .Site.Params "custom_css" -}}
{{ range .Site.Params.custom_css }}
<link rel="stylesheet" type="text/css" href="{{ $.Site.BaseURL }}{{ . }}">
{{ end }}
{{ end }}
{{ range .AlternativeOutputFormats -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type (.Permalink | relURL) $.Site.Title | safeHTML }}
{{ end }}
<link rel="stylesheet" type="text/css" href="{{ . | relURL }}">
{{- end -}}
{{- end -}}
{{ range .AlternativeOutputFormats }}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type (.Permalink | relURL) $.Site.Title | safeHTML }}
{{- end }}
</head>

View file

@ -3,27 +3,26 @@
<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 }}
<i class="bi me-2" data-feather="home"></i> <!-- TODO Via SVG eigenes Icon vielleicht mal zeichnen wie bei Bootstrap mit MDN als Inhalt -->
{{- 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 }}
{{- 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 }}
{{- 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 }}
{{- end }}
</nav>
</div>
</div>

View file

@ -1,8 +1,8 @@
{{ $dateTime := .PublishDate.Format "2006-01-02" }}
{{ $dateTimeMod := .Lastmod.Format "2006-01-02" }}
{{ $dateFormat := .Site.Params.dateFormat | default "Jan 2, 2006" }}
{{- $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 }}
{{- .Page.Params.Author -}}
<span class="badge bg-secondary"><time datetime="{{ $dateTimeMod }}">{{ .Lastmod.Format $dateFormat }}</time></span>

View file

@ -1,5 +1,5 @@
{{ $tagsIdent := .Site.Params.Blog.Tags | default "tags" }}
{{- $tagsIdent := .Site.Params.Blog.Tags | default "tags" -}}
{{- partial "taxonomy/metatag.html" (dict "Params" .Params "Ident" $tagsIdent "Feather" "tag") -}}
{{ $catIdent := .Site.Params.Blog.Categories | default "categories" }}
{{- $catIdent := .Site.Params.Blog.Categories | default "categories" -}}
{{- partial "taxonomy/metatag.html" (dict "Params" .Params "Ident" $catIdent "Feather" "award") -}}

View file

@ -1,2 +1,2 @@
{{ $skillIdent := .Site.Params.KnowHow.Skills | default "skills" }}
{{- $skillIdent := .Site.Params.KnowHow.Skills | default "skills" -}}
{{- partial "taxonomy/metatag.html" (dict "Params" .Params "Ident" $skillIdent "Feather" "code") -}}

View file

@ -4,34 +4,34 @@
<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) }}
{{- 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 }}
{{- end -}}
{{ if $pag.HasPrev }}
{{- if $pag.HasPrev }}
<li class="page-item"><a href="{{ $pag.Prev.URL }}" rel="prev" class="page-link">&lsaquo;</a></li>
{{ end }}
{{- end -}}
{{ range $pag.Pagers }}
{{ if eq . $pag }} <!-- Current Page -->
{{- 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 -->
{{- 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 }}
{{- 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 }}
{{- end }}
{{- end -}}
{{ if $pag.HasNext }}
{{- if $pag.HasNext }}
<li class="page-item"><a href="{{ $pag.Next.URL }}" rel="next" class="page-link">&rsaquo;</a></li>
{{ end }}
{{- end -}}
<!-- Don't show on last and 2nd last page -->
{{ if and (ne $pag.PageNumber $pag.TotalPages) ((ne $pag.PageNumber (sub $pag.TotalPages 1))) }}
{{- 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 }}
{{- end }}
</ul>
</nav>
{{ end }}
{{- end }}

View file

@ -1,16 +1,12 @@
{{ $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 -}}
{{- $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>
{{- end }}
<script>
feather.replace();
</script>

View file

@ -1,14 +1,14 @@
{{ $htmlTable := .content }}
{{- $htmlTable := .content -}}
<!-- Tabellenklassen hinzufügen -->
{{ $old_tbl := "<table>"}}
{{ $new_tbl := printf "<table class=\"%s\">" .table_class }}
{{ $htmlTable := replace $htmlTable $old_tbl $new_tbl }}
{{- $old_tbl := "<table>" -}}
{{- $new_tbl := printf "<table class=\"%s\">" .table_class -}}
{{- $htmlTable := replace $htmlTable $old_tbl $new_tbl -}}
<!-- Tabellenkopf hinzufügen -->
{{ $old_th := "<thead>"}}
{{ $new_th := printf "<thead class=\"%s\">" .thead_class }}
{{ $htmlTable := replace $htmlTable $old_th $new_th }}
{{- $old_th := "<thead>" -}}
{{- $new_th := printf "<thead class=\"%s\">" .thead_class -}}
{{- $htmlTable := replace $htmlTable $old_th $new_th -}}
<!-- Tabellen-HTML-Code -->
{{ $htmlTable | safeHTML }}
<!-- Tabellen-HTML-Code -->
{{- $htmlTable | safeHTML -}}

View file

@ -1,11 +1,11 @@
{{ with .avatar }}
{{- with .avatar }}
<div class="py-1 text-center">
<img class="rounded-circle" src="{{ . }}" alt="Ansprechendes Bild"/>
</div>
{{ end }}
{{- end -}}
{{ with .description }}
{{- with .description }}
<div class="py-1">
{{ . }}
</div>
{{ end }}
{{- end }}

View file

@ -1,15 +1,15 @@
<div class="tag-cloud d-inline-block m-0 p-0">
{{ $parentLink := (site.GetPage (printf "/%s" .ident)).Permalink }}
{{ $maxCnt := mul 1.0 (index .tax.ByCount 0).Count }}
{{ $minCnt := mul 1.0 (index .tax.ByCount.Reverse 0).Count }}
{{ $div := math.Max 1 (sub $maxCnt $minCnt) }}
{{ range $key, $sites := .tax }}
{{- $parentLink := (site.GetPage (printf "/%s" .ident)).Permalink -}}
{{- $maxCnt := mul 1.0 (index .tax.ByCount 0).Count -}}
{{- $minCnt := mul 1.0 (index .tax.ByCount.Reverse 0).Count -}}
{{- $div := math.Max 1 (sub $maxCnt $minCnt) -}}
{{- range $key, $sites := .tax }}
<!-- add (mul (math.Pow (div $sites.Count $maxCnt) 2.0) 14.0) 8.0 px -->
{{- (printf `<a class="tag-cloud-link m-1 p-1" style="font-size: %.3frem;" href="%s" aria-label="%s %d Einträge">%s<sup>%d</sup></a>`
(add (mul (math.Pow (div (sub $sites.Count $minCnt) $div) 2.0) 0.6) 0.8)
((printf "%s%s" $parentLink $key) | relURL) $key $sites.Count $key $sites.Count
) | safeHTML -}}
<!--<span class="badge">{{ $sites.Count }}</span>-->
{{ end }}
{{- end }}
</div>
{{/* https://mertbakir.gitlab.io/hugo/tag-cloud-in-hugo/ */}}

View file

@ -1,16 +1,16 @@
<ul>
{{ range (where . "visible" 1) }}
{{- range (where . "visible" 1) }}
<li>
{{ .name }}
<ul>
{{ range (where .urls "visible" 1) }}
{{- range (where .urls "visible" 1) }}
<li>
<a href="{{ .url }}" target="{{- .target -}}" alt="{{- .description }}">{{ .name }}</a>
<br/>
{{ .description }}
{{- .description }}
</li>
{{ end }}
{{- end }}
</ul>
</li>
{{ end }}
{{- end }}
</ul>

View file

@ -1,36 +1,36 @@
<div class="py-1 social">
<ul class="social-links">
{{ with .Email }}
{{- with .Email }}
<li><a href="mailto:{{ . }}"><i data-feather="mail"></i>&nbsp;{{ . }}</a></li>
{{ end }}
{{- end -}}
{{ with .Phone }}
<li><a href="tel:{{ . }}"><i class="bi" data-feather="phone"></i>&nbsp;{{ . }}</a></li>
{{ end }}
{{- end -}}
{{ with .VoIP }}
<li><a href="sip:{{ . }}"><i data-feather="phone"></i>&nbsp;{{ . }}</a></li>
{{ end }}
{{- end -}}
{{ with .Github }}
<li><a href="https://github.com/{{ . }}" target="_blank"><i data-feather="github"></i>&nbsp;{{ . }}</a></li>
{{ end }}
{{- end -}}
{{ with .Twitter }}
<li><a href="https://twitter.com/{{ . }}" target="_blank"><i class="bi" data-feather="twitter"></i>&nbsp;{{ . }}</a></li>
{{ end }}
{{- end -}}
{{ with .LinkedIn }}
<li><a href="https://linkedin.com/in/{{ . }}" target="_blank"><i class="bi" data-feather="linkedin"></i>&nbsp;{{ . }}</a></li>
{{ end }}
{{- end -}}
{{ with .Matrix }}
<li><a href="https://matrix.to/#/{{ . }}" target="_blank"><img src="/img/matrix-badge.svg" alt="Chat on matrix">&nbsp;{{ . }}</a></li>
{{ end }}
{{- end -}}
{{ with .RSS }}
<li><a href="{{ . }}"><i class="bi" data-feather="rss"></i>&nbsp;RSS</a></li>
{{ end }}
{{- end }}
</ul>
</div>
<!-- Hier die Links zu Mail usw. vielleicht auch zum SIP Anschluss, vielleicht mit dem Icons aus faether oder Bootstrap -->

View file

@ -1,9 +1,9 @@
<div class="categories mb-2 d-inline-block">
{{ $parentLink := (site.GetPage (printf "/%s" .ident)).Permalink }}
{{ range $key, $sites := .tax }}
{{- $parentLink := (site.GetPage (printf "/%s" .ident)).Permalink -}}
{{- range $key, $sites := .tax }}
<div class="m-1 d-inline-flex">
<a class="bg-dark text-white py-1 px-2 m-0 rounded-start" href="{{ (printf "%s%s" $parentLink $key) | relURL }}">{{ $key }}</a>
<div class="bg-danger text-white py-1 px-2 m-0 rounded-end">{{ $sites.Count }}</div>
</div>
{{ end }}
{{- end }}
</div>