CHANGE image handling, ADD partials to reuse structure, REFACTOR

This commit is contained in:
Hoernschen 2025-04-17 16:22:33 +02:00
parent 1265491dee
commit 01dcf04b8a
Signed by: hoernschen
GPG key ID: 37591FAF4E6D3462
36 changed files with 1181 additions and 864 deletions

View file

@ -1,5 +1,5 @@
{{ define "main" }}
<div class="notfound">
<img class="notfoundimage" src="/images/undraw_page_not_found_su7k.svg" alt="Not Found Image">
</div>
{{ end }}
<div class="notfound">
{{- partial "components/image.html" (dict "type" "svg" "url" "/images/notfound.svg" "alt" "Not Found Image") -}}
</div>
{{ end }}

View file

@ -0,0 +1 @@
{{- partial "components/image.html" (dict "url" .Destination "alt" .Text "caption" .Title) -}}

View file

@ -1,63 +1,52 @@
<!DOCTYPE html>
<!doctype html>
<html lang="{{ .Site.LanguageCode }}">
<head>
<meta name="description" content="{{ if .Params.summary }}{{ .Params.summary }}{{ else if .Site.Params.Description }}{{ .Site.Params.Description }}{{ else }}Hardcoded description; the author should update :){{ end }}" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no" />
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>{{ if .Title }}{{ .Title }}{{ else }}{{ .Site.Title }}{{ end }}</title>
{{ block "opengraph" . }}
<meta property="og:type" content="website" />
{{ with .Site.LanguageCode }}
<meta property="og:locale" content='{{ replace . "-" "_" }}' />
{{ end }}
<meta property="og:title" content="{{ if .Title }}{{ .Title }}{{ else }}{{ .Site.Title }}{{ end }}" />
<meta property="og:url" content="{{ .Permalink }}" />
<meta property="og:site_name" content="{{ .Site.Title }}" />
{{ if .Params.image }}
<meta property="og:image" content="{{ .Params.image | absURL }}" />
{{ else }}
<meta property="og:image" content="{{ .Site.Params.logo | absURL }}" />
{{ end }}
{{ if .Params.summary }}
<meta property="og:description" content="{{ .Params.summary }}" />
{{ else if .Content }}
<meta property="og:description" content="{{ .Content | safeHTML | truncate 100 }}" />
{{ else }}
<meta property="og:description" content="{{ .Site.Params.Description }}" />
{{ end }}
{{ end }}
{{- $favIcon := .Site.Params.favIcon }}
<link rel="icon" type="image/png" sizes="16x16" href="{{ if $favIcon.small }}{{ $favIcon.small }}{{ else }}/favIcon16x16.png{{ end }}">
<link rel="icon" type="image/png" sizes="32x32" href="{{ if $favIcon.big }}{{ $favIcon.big }}{{ else }}/favIcon32x32.png{{ end }}">
{{ with .Site.Params.tracking }}
<script src="{{ . }}"></script>
{{ end }}
<link rel="stylesheet" type="text/css" href="/icons/fontawesome.css">
{{ $template := resources.Get "scss/index.scss" }}
{{ if $template }}
{{ $index := $template | resources.ExecuteAsTemplate "css/index.scss" . | resources.ToCSS (dict "outputStyle" "compressed") | fingerprint }}
<link rel="stylesheet" type="text/css" href="{{ $index.RelPermalink }}">
{{ end }}
{{ block "styling" . }}
{{ end }}
{{ $template := resources.Get "scss/totop.scss" }}
{{ if $template }}
{{ $totop := $template | resources.ExecuteAsTemplate "css/totop.scss" . | resources.ToCSS (dict "outputStyle" "compressed") | fingerprint }}
<link rel="stylesheet" type="text/css" href="{{ $totop.RelPermalink }}">
{{ end }}
</head>
<body>
{{ block "header" . }}
{{- partial "header.html" . -}}
{{ end }}
{{ block "main" . }}
<!-- The part of the page that begins to differ between templates -->
{{ end }}
{{ block "footer" . }}
{{- partial "footer.html" . -}}
{{ end }}
</body>
</html>
<head>
<meta name="description"
content="{{ if .Params.summary }}{{ .Params.summary }}{{ else if .Site.Params.Description }}{{ .Site.Params.Description }}{{ else }}Hardcoded description; the author should update :){{ end }}" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<meta name="color-scheme" content="light">
{{ template "_internal/opengraph.html" . }}
<title>
{{ if .Title }}{{ .Title }}{{ else }}{{ .Site.Title }}{{ end }}
</title>
{{ with .Site.Params.favIcon }}
{{ if .ico }}
<link rel="icon" type="image/x-icon" href="{{ .ico }}">
{{ end }}
{{ if .small }}
<link rel="icon" type="image/png" sizes="16x16" href="{{ .small }}">
{{ end }}
{{ if .big }}
<link rel="icon" type="image/png" sizes="32x32" href="{{ .big }}">
{{ end }}
{{ end }}
{{ with .Site.Params.tracking }}
<script src="{{ . }}"></script>
{{ end }}
<link rel="stylesheet" type="text/css" href="/icons/fontawesome.css" />
{{ $template := resources.Get "scss/index.scss" }} {{ if $template }} {{
$index := $template | resources.ExecuteAsTemplate "css/index.scss" . |
resources.ToCSS (dict "outputStyle" "compressed") | fingerprint }}
<link rel="stylesheet" type="text/css" href="{{ $index.RelPermalink }}" />
{{ end }} {{ block "styling" . }} {{ end }} {{ $template := resources.Get
"scss/totop.scss" }} {{ if $template }} {{ $totop := $template |
resources.ExecuteAsTemplate "css/totop.scss" . | resources.ToCSS (dict
"outputStyle" "compressed") | fingerprint }}
<link rel="stylesheet" type="text/css" href="{{ $totop.RelPermalink }}" />
{{ end }}
</head>
<body>
{{ block "header" . }} {{- partial "header.html" . -}} {{ end }}
<main>
{{ block "main" . }}
<!-- The part of the page that begins to differ between templates -->
{{ end }}
</main>
{{ block "footer" . }} {{- partial "footer.html" . -}} {{ end }}
</body>
</html>

View file

@ -1,27 +1,24 @@
{{ define "main" }}
{{ with .Params.image }}
{{ if .url }}
<img class="coverimage" src="{{ .url }}" alt="{{ .alt }}" />
{{- partial "components/image.html" (dict "style" "coverimage" "url" .url "alt" .alt) -}}
{{ else }}
<img class="coverimage" src="{{ . }}" />
{{- partial "components/image.html" (dict "style" "coverimage" "url" .) -}}
{{ end }}
{{ end }}
{{ if .Content }}
<div class="content">
{{ with .Title }}
<div class="title">
<h1 class="content-title">{{ . }}</h1>
<div class="divider"></div>
</div>
{{ partial "components/title.html" . }}
{{ end }}
{{.Content}}
</div>
{{ else }}
{{ else if .Params.header.enabled }}
<div class="header-blocker"></div>
{{ end }}
{{- range $index, $page := .Pages }}
{{ $odd := mod $index 2 }}
{{ $id := .Params.id | default $page.File.ContentBaseName }}
{{ $id := .Params.id | default $page.Name }}
{{ if eq .Params.type "slider" }}
{{- partial "slider.html" (dict "id" $id "slider" .Params "color" $.Site.Params.color "odd" $odd) -}}
{{ else if eq .Params.type "hero" }}

View file

@ -1,18 +1,15 @@
{{ define "main" }}
{{ with .Params.image }}
{{ if .url }}
<img class="coverimage" src="{{ .url }}" alt="{{ .alt }}" />
{{ else }}
<img class="coverimage" src="{{ . }}" />
{{ end }}
{{ with .Params.image }}
{{ if .url }}
{{- partial "components/image.html" (dict "style" "coverimage" "url" .url "alt" .alt) -}}
{{ else }}
{{- partial "components/image.html" (dict "style" "coverimage" "url" . "alt" "Cover") -}}
{{ end }}
<div class="content">
{{ with .Title }}
<div class="title">
<h1 class="content-title">{{ . }}</h1>
<div class="divider"></div>
</div>
{{ end }}
{{ .Content }}
</div>
{{ end }}
<div class="content">
{{ with .Title }}
{{ partial "components/title.html" . }}
{{ end }}
{{ .Content }}
</div>
{{ end }}

View file

@ -1,10 +1,7 @@
{{ define "main" }}
<div class="content">
<article>
<div class="title">
<h1 class="content-title">{{ .Title }}</h1>
<div class="divider"></div>
</div>
{{ partial "components/title.html" .Title }}
{{.Content}}
</article>
<div class="cardList">
@ -13,9 +10,9 @@
<a href="{{.Permalink}}">
<div class="cardContent">
{{ if .Params.image }}
<img class="cardImage {{ if eq .Params.image.cover false }} noCover {{ end }}" alt="{{ .Params.image.alt }}" src="{{ .Params.image.url }}" />
{{- partial "components/image.html" (dict "style" "cardImage" "url" .Params.image.url "alt" .Params.image.alt) -}}
{{ else }}
<img class="cardImage" src="{{ .Site.Params.defaultimage }}" alt="Default Image" />
{{- partial "components/image.html" (dict "style" "cardImage" "url" .Site.Params.defaultimage "alt" "Placeholder") -}}
{{ end }}
<div class="cardTitle">{{.Title}}</div>
<div class="cardDescription">{{ .Summary | safeHTML | truncate 320 }}</div>
@ -26,4 +23,4 @@
{{ end }}
</div>
</div>
{{ end }}
{{ end }}

View file

@ -1,20 +1,17 @@
{{ define "main" }}
<div class="content">
<article>
<div class="title">
<h1 class="content-title">{{ .Title }}</h1>
<div class="divider"></div>
</div>
</article>
<!-- Ranges through content/posts/*.md -->
<div class="cardList">
<article>
{{ partial "components/title.html" .Title }}
</article>
<!-- Ranges through content/posts/*.md -->
<div class="cardList">
{{ range .Pages }}
<a href="{{.Permalink}}">
<div class="smallCard">
<div class="cardTitle">{{.Title}}</div>
</div>
</a>
<a href="{{.Permalink}}">
<div class="smallCard">
<div class="cardTitle">{{.Title}}</div>
</div>
</a>
{{ end }}
</div>
</div>
</div>
{{ end }}
{{ end }}

View file

@ -1,7 +1,6 @@
{{ $outlined := "outlined"}}
<a class="{{if eq .type $outlined}} button-outlined {{else}} button-filled {{end}}" href="{{ .url }}">
<a id="{{ .id }}" class='button {{ .type | default "filled" }}' href="{{ .url }}">
{{ with .icon }}
<i class="icon-{{ . }}"></i>
{{ end }}
{{ .text }}
</a>
</a>

View file

@ -0,0 +1,9 @@
<!--
type: string - default: link
text: string (optional)
url: string
-->
<a href="{{ .url }}" rel="{{ .rel }}">
<i class="{{ if .type }} icon-{{ .type }} {{ else }} icon-link {{ end }}"></i>
{{ if .text }} {{ .text }}{{ end }}
</a>

View file

@ -0,0 +1,90 @@
<!--
id: string
style: string - default empty
url: string
alt: string
caption: string
width: int
height: int
-->
{{ $sizes := slice "320" "640" "960" "1280" }}
{{ $mediaWidthControl := "(max-width: 360px) 320px, (max-width: 680px) 640px, (max-width: 1100px) 960px, 1280px" }}
{{ $id := .id }}
{{ $style := .style }}
{{ $alt := .alt }}
{{ $caption := .caption }}
{{ $width := .width }}
{{ $height := .height }}
{{ $img := .Page.Resources.GetMatch .url }}
{{ if not $img }}
{{ $img = resources.Get .url }}
{{ if not $img }}
{{ $img := resources.GetRemote .url | resources.Copy (path.Join "images" (path.Base .url )) }}
{{ end }}
{{ end }}
{{ with $img }}
{{ $url := .RelPermalink }}
{{ $type := .MediaType.SubType }}
{{ $ext := path.Ext $url }}
{{ $name := path.Base (replace $url $ext "") }}
{{ $dir := path.Dir $url }}
{{ if eq $type "svg" }}
<img
id="{{ $id }}"
class="{{ $style }}"
src="{{ $url }}"
alt="{{ $alt }}"
loading="lazy"
decoding="async"
>
{{ else }}
<picture>
<source
type="image/avif"
srcset="
{{ range $i, $size := $sizes }}
{{ $dir }}/{{ $name }}-{{ $size }}{{ $ext }}.avif {{ $size }}w,
{{ end }}
{{ $url }}.avif {{ $width | default .Width }}w
"
sizes="{{ $mediaWidthControl }}"
/>
<source
type="image/webp"
srcset="
{{ range $i, $size := $sizes }}
{{ $dir }}/{{ $name }}-{{ $size }}{{ $ext }}.webp {{ $size }}w,
{{ end }}
{{ $url }}.webp {{ $width | default .Width }}w
"
sizes="{{ $mediaWidthControl }}"
/>
<img
id="{{ $id }}"
class="{{ $style }}"
width="{{ $width | default .Width }}"
height="{{ $height | default .Height }}"
srcset="
{{ range $i, $size := $sizes }}
{{ $dir }}/{{ $name }}-{{ $size }}{{ $ext }} {{ $size }}w,
{{ end }}
{{ $url }} {{ $width | default .Width }}w
"
src="{{ $url }}"
alt="{{ $alt }}"
loading="lazy"
decoding="async"
>
</picture>
{{ end }}
{{ if $caption }}
<p class="caption">{{ $caption }}</p>
{{ end }}
{{ end }}
{{/* https://www.brycewray.com/posts/2023/05/better-code-image-processing-hugo-render-hook-edition/ */}}

View file

@ -0,0 +1,4 @@
<div class="title">
<h1 class="content-title">{{ . }}</h1>
<div class="divider"></div>
</div>

View file

@ -1,22 +1,19 @@
{{- $contact := .contact }}
{{- $content := .content }}
{{- $id := "contact"}}
{{if $contact.id}}
{{- $id = $contact.id}}
{{else if .id}}
{{- $id = .id }}
{{- $contact := .contact }} {{- $content := .content }} {{- $id := "contact"}}
{{if $contact.id}} {{- $id = $contact.id}} {{else if .id}} {{- $id = .id }}
{{end}}
<div id="{{ $id }}" class="section section-highlight">
<div class="section-content contact">
<div class="contact-text">
<h1>{{ $contact.title }}</h1>
{{ if $contact.subtitle }}
<h3>{{ $contact.subtitle }}</h3>
{{ end }}
<p>{{ $content }}</p>
</div>
<div class="contact-button-container">
<a class="contact-button" href="{{ $contact.button.url }}">{{ $contact.button.text }}</a>
</div>
<div class="section-content contact">
<div class="contact-text">
<h1>{{ $contact.title }}</h1>
{{ if $contact.subtitle }}
<h3>{{ $contact.subtitle }}</h3>
{{ end }}
<p>{{ $content }}</p>
</div>
<div class="contact-button-container">
{{ with $contact.button }}
{{ partial "components/button.html" . }}
{{ end }}
</div>
</div>
</div>

View file

@ -9,10 +9,7 @@
<div id="{{ $id }}" class="section {{if eq $odd 0}} section-even {{end}}">
<div class="section-content funding">
{{ with $params.title }}
<div class="title">
<h1 class="content-title">{{ . }}</h1>
<div class="divider"></div>
</div>
{{ partial "components/title.html" . }}
{{ end }}
{{ .content }}
</div>

View file

@ -1,4 +1,5 @@
{{- $footer := .Site.Params.footer }}
{{ if $footer.enabled }}
{{- $social := index $footer "social" }}
{{- $links := index $footer "links" }}
{{ $template := resources.Get "scss/footer.scss" }}
@ -10,9 +11,11 @@
<div class="social-media-footer">
<span>
{{- range $social}}
<a href="{{ .url }}"><i class="icon-{{ .type }}"></i></a>
{{ partial "components/icon.html" . }}
{{- end }}
<a href="/posts/index.xml"><i class="icon-rss"></i></a>
{{ if $footer.rss }}
{{ partial "components/icon.html" (dict "type" "rss" "url" "/posts/index.xml") }}
{{ end }}
</span>
</div>
<div>
@ -26,5 +29,6 @@
© {{ dateFormat "2006" now }} {{ $footer.copyright }}</a>
</div>
</footer>
<a class="totop hide" id="totop" href="#"><i class="icon-angle-up"></i></a>
<script src="/js/totop.js"></script>
{{ end }}
{{ partial "components/button.html" (dict "id" "totop" "type" "fab hide" "url" "#" "icon" "angle-up") }}
<script src="/js/totop.js"></script>

View file

@ -1,44 +1,50 @@
{{- $header := .Site.Params.header }}
{{- $links := index $header "links" }}
{{ $template := resources.Get "scss/header.scss" }}
{{ if $template }}
{{ $index := $template | resources.ExecuteAsTemplate "css/header.scss" . | resources.ToCSS (dict "outputStyle" "compressed") | fingerprint }}
<link rel="stylesheet" type="text/css" href="{{ $index.RelPermalink }}">
{{ end }}
{{- $header := .Site.Params.header }}
{{- $links := index $header "links" }}
{{ $template := resources.Get "scss/progressbar.scss" }}
{{ if $template }}
{{ $progressbar := $template | resources.ExecuteAsTemplate "css/progressbar.scss" . | resources.ToCSS (dict "outputStyle" "compressed") | fingerprint }}
{{ $progressbar := $template | resources.ExecuteAsTemplate "css/progressbar.scss" . | resources.ToCSS (dict
"outputStyle" "compressed") | fingerprint }}
<link rel="stylesheet" type="text/css" href="{{ $progressbar.RelPermalink }}">
{{ end }}
<div class="progress"></div>
{{ if $header.enabled }}
{{ $template := resources.Get "scss/header.scss" }}
{{ if $template }}
{{ $index := $template | resources.ExecuteAsTemplate "css/header.scss" . | resources.ToCSS (dict "outputStyle"
"compressed") | fingerprint }}
<link rel="stylesheet" type="text/css" href="{{ $index.RelPermalink }}">
{{ end }}
<header class="header" id="header">
<div class="header-container">
<a class="home" href="/#"><img id="logo" class="logo" src="{{ .Site.Params.logo }}" alt="Logo"></a>
<div class="header-items" id="header-items">
{{- range $links}}
{{ if .links }}
<div class="header-item dropdown">
<button class="dropbtn">{{ .text }}
<i class="icon-caret-down"></i>
</button>
<div class="dropdown-content">
{{- range .links}}
<a href="{{ .url }}">{{ .text }}</a>
{{- end }}
</div>
</div>
{{ else }}
<a class="header-item" href="{{ .url }}">{{ .text }}</a>
{{ end }}
{{- end }}
{{ if $header.button }}
{{- range $header.button }}
{{ partial "components/button.html" . }}
{{- end }}
{{ end }}
<div class="header-container">
<a class="home" href="/#">
{{- partial "components/image.html" (dict "id" "logo" "style" "logo" "url" .Site.Params.logo "alt" "Logo") -}}
</a>
<div class="header-items" id="header-items">
{{- range $links}}
{{ if .links }}
<div class="header-item dropdown">
<button class="dropbtn">{{ .text }}
<i class="icon-caret-down"></i>
</button>
<div class="dropdown-content">
{{- range .links}}
<a href="{{ .url }}">{{ .text }}</a>
{{- end }}
</div>
</div>
{{ else }}
<a class="header-item" href="{{ .url }}">{{ .text }}</a>
{{ end }}
{{- end }}
{{ if $header.button }}
{{- range $header.button }}
{{ partial "components/button.html" . }}
{{- end }}
{{ end }}
</div>
<a href="javascript:void(0);" id="menu-icon" class="menu-icon" onclick="unfoldHeader()">&#9776;</a>
</div>
<a href="javascript:void(0);" id="menu-icon" class="menu-icon" onclick="unfoldHeader()">&#9776;</a>
</header>
<script src="/js/header.js"></script>
<script src="/js/progress.js"></script>
{{ end }}
<script src="/js/progress.js"></script>

View file

@ -4,32 +4,33 @@
{{- $odd := .odd }}
{{- $id := "hero"}}
{{if $hero.id}}
{{- $id := $hero.id}}
{{- $id := $hero.id}}
{{else if .id}}
{{- $id := .id }}
{{- $id := .id }}
{{end}}
{{ $template := resources.Get "scss/hero.scss" }}
{{ if $template }}
{{ $index := $template | resources.ExecuteAsTemplate "css/hero.scss" . | resources.ToCSS (dict "outputStyle" "compressed") | fingerprint }}
{{ $index := $template | resources.ExecuteAsTemplate "css/hero.scss" . | resources.ToCSS (dict "outputStyle"
"compressed") | fingerprint }}
<link rel="stylesheet" type="text/css" href="{{ $index.RelPermalink }}">
{{ end }}
<div id="{{ $id }}" class="section {{if eq $odd 0}} section-even {{end}} row hero">
<div class="section-content services">
<div class="hero-description col-5">
<div class="title">
<h1 class="content-title">{{ $hero.title }}</h1>
<div class="divider"></div>
</div>
<p>{{ $content }}</p>
<br />
{{ with $hero.button }}
{{- range .}}
{{ partial "components/button.html" . }}
{{- end }}
{{ end }}
</div>
<div class="hero-icon-container col-7">
<img class="service-icon" alt="{{ $hero.image.alt }}" src="{{ $hero.image.url }}">
</div>
<div class="section-content services">
<div class="hero-description col-5">
{{ with $hero.logo }}
{{- partial "components/image.html" (dict "type" .type "style" .style "url" .url "alt" .alt "width" .width "height" .height) -}}
{{ end }}
{{ partial "components/title.html" $hero.title }}
<p>{{ $content }}</p>
<br />
{{ with $hero.button }}
{{- range .}}
{{ partial "components/button.html" . }}
{{- end }}
{{ end }}
</div>
</div>
<div class="side-image col-7">
{{- partial "components/image.html" $hero.image -}}
</div>
</div>
</div>

View file

@ -10,10 +10,7 @@
<div id="{{ $id }}" class="section {{if eq $odd 0}} section-even {{end}}">
<div class="section-content">
{{ with $links.title }}
<div class="title">
<h1 class="content-title">{{ . }}</h1>
<div class="divider"></div>
</div>
{{ partial "components/title.html" . }}
{{ end }}
<div class="cardList">
{{- range $links.links}}
@ -21,13 +18,14 @@
<a href="{{ .url }}">
<div class="cardContent">
{{ if .image }}
<img class="cardImage {{ if eq .image.cover false }} noCover {{ end }}" alt="{{ .image.alt }}" src="{{ .image.url }}" />
{{ $style := "cardImage {{if ne .Params.image.cover }} noCover {{ end }}" }}
{{- partial "components/image.html" (dict "style" $style "url" .image.url "alt" .image.alt) -}}
{{ else if .icon }}
<div class="cardImage">
<i class="icon-{{ .icon }} cardIcon"></i>
<i class="icon-{{ .icon }}"></i>
</div>
{{ else }}
<img class="cardImage" alt="default image" src="{{ $defaultimage }}" />
{{- partial "components/image.html" (dict "style" "cardImage" "url" $defaultimage "alt" "Placeholder") -}}
{{ end }}
<div class="cardTitle">{{ .title }}</div>
</div>
@ -36,4 +34,4 @@
{{- end}}
</div>
</div>
</div>
</div>

View file

@ -9,15 +9,14 @@
<div id="{{ $id }}" class="section {{if eq $odd 0}} section-even {{end}}">
<div class="section-content funding">
{{ with $logos.title }}
<div class="title">
<h1 class="content-title">{{ . }}</h1>
<div class="divider"></div>
</div>
{{ partial "components/title.html" . }}
{{ end }}
<div class="funding-logos">
{{- range $logos.logos}}
<a href="{{ .url }}"><img class="funding-logo" src="{{ .logo }}" alt="{{ .text }}"></a>
<a href="{{ .url }}">
{{- partial "components/image.html" (dict "style" "funding-logo" "url" .logo "alt" .text) -}}
</a>
{{- end}}
</div>
</div>
</div>
</div>

View file

@ -1,37 +1,40 @@
{{- $posts := .posts }}
{{- $pages := .pages }}
{{- $defaultimage := .defaultimage }}
{{- $odd := .odd }}
{{- $id := "posts"}}
{{- $defaultimage := .defaultimage }}
{{- $odd := .odd }}
{{- $id := "posts"}}
{{if $posts.id}}
{{- $id = $posts.id}}
{{else if .id}}
{{- $id = .id }}
{{- $id = $posts.id}}
{{else if .id}}
{{- $id = .id }}
{{end}}
<div id="{{ $id }}" class="section {{if eq $odd 0}} section-even {{end}}">
<div class="section-content posts">
<div class="title">
<h1 class="content-title">{{ $posts.title }}</h1>
<div class="divider"></div>
</div>
<div class="cardList">
{{ range first 3 $pages }}
<div class="card">
<a href="{{.Permalink}}">
<div class="cardContent">
{{ if .Params.image }}
<img class="cardImage {{ if eq .Params.image.cover false }} noCover {{ end }}" alt="{{ .Params.image.alt }}" src="{{ .Params.image.url }}" />
{{ else }}
<img class="cardImage" src="{{ $defaultimage }}" alt="Defaul Image" />
{{ end }}
<div class="cardTitle">{{.Title}}</div>
<div class="cardDescription">{{ .Summary | safeHTML | truncate 320 }}</div>
<div class="cardDetail">{{.Date.Format "02.01.2006"}} | {{.ReadingTime}} Minuten</div>
</div>
</a>
</div>
<div class="section-content posts">
{{ partial "components/title.html" $posts.title }}
<div class="cardList">
{{ range first 3 $pages }}
<div class="card">
<a href="{{.Permalink}}">
<div class="cardContent">
{{ if .Params.image }}
{{ $style := "cardImage {{if ne .Params.image.cover }} noCover {{ end }}" }}
{{- partial "components/image.html" (dict "style" $style "url" .image.url "alt" .image.alt) -}}
{{ else }}
{{- partial "components/image.html" (dict "style" "cardImage" "url" $defaultimage "alt" "Placeholder") -}}
{{ end }}
</div>
<div class="more-button"><a href="{{ $posts.id }}"> {{ $posts.moretext }} </a></div>
<div class="cardTitle">{{.Title}}</div>
<div class="cardDescription">
{{ .Summary | safeHTML | truncate 320 }}
</div>
<div class="cardDetail">
{{.Date.Format "02.01.2006"}} | {{.ReadingTime}} Minuten
</div>
</div>
</a>
</div>
{{ end }}
</div>
</div>
{{ partial "components/button.html" (dict "type" "text block" "url"
$posts.id "text" ($posts.more | default "More")) }}
</div>
</div>

View file

@ -10,16 +10,13 @@
<div id="{{$id}}" class="section {{if eq $odd 0}} section-even {{end}} row">
<div class="section-content services">
{{if and ($service.image) (eq $service.image.direction "left")}}
<div class="service-icon-container col-5">
<img class="service-icon" src="{{ $service.image.url }}" alt="{{ $service.image.alt }}">
<div class="side-image col-5">
{{- partial "components/image.html" $service.image -}}
</div>
{{end}}
<div class="service-description {{if $service.image}} col-7 {{end}}">
{{ with $service.title }}
<div class="title">
<h1 class="content-title">{{ . }}</h1>
<div class="divider"></div>
</div>
{{ partial "components/title.html" . }}
{{ end }}
<p>{{ $content }}</p>
<br />
@ -30,8 +27,8 @@
{{ end }}
</div>
{{if and ($service.image) (eq $service.image.direction "right")}}
<div class="service-icon-container col-5">
<img class="service-icon" src="{{ $service.image.url }}" alt="{{ $service.image.alt }}">
<div class="side-image col-5">
{{- partial "components/image.html" $service.image -}}
</div>
{{end}}
</div>

View file

@ -23,7 +23,7 @@
<div class="slides">
{{- range $index, $slide := $slider.images}}
<div class="slide">
<img src="{{ $slide }}" alt="{{ $index }}">
{{- partial "components/image.html" (dict "url" $slide "alt" $index) -}}
{{ if gt $length 1}}
<span class="slider-navigation-right" onclick="scrollToNextSlideNr({{$index}})">
<i class="icon-angle-right"></i>
@ -41,4 +41,4 @@
<script>
window.setInterval(scrollToNextSlide, 10000)
</script>
{{ end }}
{{ end }}

View file

@ -10,18 +10,15 @@
{{end}}
<div id="{{ $id }}" class="section {{if eq $odd 0}} section-even {{end}}">
<div class="section-content team">
<div class="title">
<h1 class="content-title">{{ $team.title }}</h1>
<div class="divider"></div>
</div>
<div class="team-list">
{{ partial "components/title.html" $team.title }}
<div class="list">
{{- range first 4 ((where $pages "Params.leaveDate" "==" nil).ByParam "startDate") }}
<a href="{{.Permalink}}">
<div class="teammember">
<div class="member">
{{ if .Params.image }}
<img class="avatar" src="{{ .Params.image }}" alt="{{ .Params.name }} Avatar">
{{- partial "components/image.html" (dict "style" "avatar" "url" .Params.image "alt" .Params.name) -}}
{{ else }}
<img class="avatar" src="{{ $defaultimage }}" alt="Default Avatar">
{{- partial "components/image.html" (dict "style" "avatar" "url" $defaultimage "alt" "Placeholder") -}}
{{ end }}
<h1 class="teammember-title">{{ .Params.name }}</h1>
{{- range .Params.jobs }}
@ -30,17 +27,18 @@
<div class="social-media">
<span>
{{- range .Params.social}}
<a href="{{ .url }}"><i class="icon-{{ .type }}"></i></a>
{{ partial "components/icon.html" . }}
{{- end}}
{{if .Params.mail}}
<a href="mailto:{{ .Params.mail }}"><i class="icon-at"></i></a>
{{end}}
{{ if .Params.mail }}
{{ $mailto := "mailto:{{ .Params.mail }}" }}
{{ partial "components/icon.html" (dict "type" "at" "url" $mailto) }}
{{ end }}
</span>
</div>
</div>
</a>
{{- end }}
</div>
<div class="more-button"><a href="{{ $team.id }}"> {{ $team.moretext }} </a></div>
{{ partial "components/button.html" (dict "type" "text block" "url" $team.id "text" ($team.more | default "More")) }}
</div>
</div>
</div>

View file

@ -1,11 +1,7 @@
{{ define "main" }}
<div class="content">
<article>
<div class="title">
<h1 class="content-title">{{ .Title }}</h1>
<div class="divider"></div>
</div>
<!-- "{{.Content}}" pulls from the markdown content of the corresponding _index.md -->
{{ partial "components/title.html" .Title }}
{{.Content}}
</article>
<!-- Ranges through content/posts/*.md -->
@ -15,9 +11,10 @@
<a href="{{.Permalink}}">
<div class="cardContent">
{{ if .Params.image }}
<img class="cardImage {{ if eq .Params.image.cover false }} noCover {{ end }}" alt="{{ .Params.image.alt }}" src="{{ .Params.image.url }}" />
{{ $style := "cardImage {{if ne .Params.image.cover }} noCover {{ end }}" }}
{{- partial "components/image.html" (dict "style" $style "url" .Params.image.url "alt" .Params.image.alt) -}}
{{ else }}
<img class="cardImage" src="{{ .Site.Params.defaultimage }}" alt="Default Image" />
{{- partial "components/image.html" (dict "style" "cardImage" "url" .Site.Params.defaultimage "alt" "Placeholder") -}}
{{ end }}
<div class="cardTitle">{{.Title}}</div>
<div class="cardDescription">{{ .Summary | safeHTML | truncate 320 }}</div>
@ -28,4 +25,4 @@
{{ end }}
</div>
</div>
{{ end }}
{{ end }}

View file

@ -1,47 +1,7 @@
{{ define "opengraph" }}
<meta name="twitter:card" content="summary_large_image" />
<meta property="og:type" content="article" />
{{ with .Site.LanguageCode }}
<meta property="og:locale" content='{{ replace . "-" "_" }}' />
{{ end }}
<meta property="og:title" content="{{ if .Title }}{{ .Title }}{{ else }}{{ .Site.Title }}{{ end }}" />
<meta name="twitter:title" content="{{ if .Title }}{{ .Title }}{{ else }}{{ .Site.Title }}{{ end }}" />
<meta property="og:url" content="{{ .Permalink }}" />
<meta property="og:site_name" content="{{ .Site.Title }}" />
{{ if .Params.image }}
<meta property="og:image" content="{{ .Params.image | absURL }}" />
<meta name="twitter:image" content="{{ .Params.image | absURL }}" />
{{ else }}
<meta property="og:image" content="{{ .Site.Params.logo | absURL }}" />
<meta name="twitter:image" content="{{ .Site.Params.logo | absURL }}" />
{{ end }}
{{ if .Params.summary }}
<meta property="og:description" content="{{ .Params.summary }}" />
<meta name="twitter:description" content="{{ .Params.summary }}" />
{{ else if .Content }}
<meta property="og:description" content="{{ .Content | safeHTML | truncate 100 }}" />
<meta name="twitter:description" content="{{ .Params.summary }}" />
{{ else }}
<meta property="og:description" content="{{ .Site.Params.Description }}" />
<meta name="twitter:description" content="{{ .Params.summary }}" />
{{ end }}
<meta property="article:published_time" content='{{.Date.Format "2006-01-02"}}' />
{{ with .Params.author }}
<meta property="article:author" content="{{ . }}" />
{{ end }}
<meta property="article:section" content="Blog" />
{{ with .Params.tags }}
{{ range . }}
<meta property="article:tag" content="{{ . }}" />
{{ end }}
{{ end }}
{{ end }}
{{ define "main" }}
{{ with .Params.image }}
<img class="coverimage {{ if eq .cover false }} noCover {{ end }}" alt="{{ .alt }}" src="{{ .url }}" />
{{ $style := "coverimage {{if ne .Params.image.cover }} noCover {{ end }}" }}
{{- partial "components/image.html" (dict "style" $style "url" .url "alt" .alt) -}}
{{ with .copyright }}
<div class="image-copyright">© {{ . }}</div>
{{ end }}
@ -67,18 +27,18 @@
<a href="{{.Permalink}}">
<div class="author">
{{ if .Params.image }}
<img class="avatar-small" src="{{ .Params.image }}" alt="{{ .Params.name }} Avatar">
{{- partial "components/image.html" (dict "style" "avatar-small" "url" .Params.image "alt" .Params.name) -}}
{{ else }}
<img class="avatar-small" src="{{ $.Site.Params.defaultimage }}" alt="Default Avatar">
{{- partial "components/image.html" (dict "style" "avatar-small" "url" $.Site.Params.defaultimage "alt" "Placeholder") -}}
{{ end }}
<h4 class="author-title">{{ .Params.name }}</h4>
<div class="social-media">
<span>
{{- range .Params.social}}
<a href="{{ .url }}"><i class="icon-{{ .type }}"></i></a>
{{ partial "components/icon.html" . }}
{{- end}}
{{if .Params.mail}}
<a href="mailto:{{ .Params.mail }}"><i class="icon-at"></i></a>
{{ partial "components/icon.html" (dict "type" "at" "url" "mailto:{{ .Params.mail }}") }}
{{end}}
</span>
</div>
@ -88,4 +48,4 @@
{{ end }}
{{ end }}
</div>
{{ end }}
{{ end }}

View file

@ -1,10 +1,7 @@
{{ define "main" }}
<div class="content">
<article>
<div class="title">
<h1 class="content-title">{{ .Title }}</h1>
<div class="divider"></div>
</div>
{{ partial "components/title.html" .Title }}
{{.Content}}
</article>
<div class="team-list">
@ -12,9 +9,9 @@
<a href="{{.Permalink}}">
<div class="teammember">
{{ if .Params.image }}
<img class="avatar" src="{{ .Params.image }}" alt="{{ .Params.name }} Avatar">
{{- partial "components/image.html" (dict "style" "avatar" "url" .Params.image "alt" .Params.name) -}}
{{ else }}
<img class="avatar" src="{{ $.Site.Params.defaultimage }}" alt="Default Avatar">
{{- partial "components/image.html" (dict "style" "avatar" "url" $.Site.Params.defaultimage "alt" "Placeholder") -}}
{{ end }}
<h1 class="teammember-title">{{ .Params.name }}</h1>
{{- range .Params.jobs }}
@ -23,10 +20,10 @@
<div class="social-media">
<span>
{{- range .Params.social}}
<a href="{{ .url }}"><i class="icon-{{ .type }}"></i></a>
{{ partial "components/icon.html" . }}
{{- end}}
{{if .Params.mail}}
<a href="mailto:{{ .Params.mail }}"><i class="icon-at"></i></a>
{{ partial "components/icon.html" (dict "type" "at" "url" "mailto:{{ .Params.mail }}") }}
{{end}}
</span>
</div>
@ -35,4 +32,4 @@
{{ end }}
</div>
</div>
{{ end }}
{{ end }}

View file

@ -2,7 +2,7 @@
<div class="content">
<div class="teammember-header">
{{ with .Params.image }}
<img class="teammember-header-avatar" src="{{ . }}" alt="Avatar">
{{- partial "components/image.html" (dict "style" "teammember-header-avatar" "url" . "alt" "Avatar") -}}
{{ end }}
<div>
<div class="teammember-header-title">
@ -10,10 +10,10 @@
<div class="teammember-header-social-media">
<span>
{{- range .Params.social}}
<a href="{{ .url }}"><i class="icon-{{ .type }}"></i></a>
{{ partial "components/icon.html" . }}
{{- end}}
{{if .Params.mail}}
<a href="mailto:{{ .Params.mail }}"><i class="icon-at"></i></a>
{{ partial "components/icon.html" (dict "type" "at" "url" "mailto:{{ .Params.mail }}") }}
{{end}}
</span>
</div>
@ -35,9 +35,10 @@
<a href="{{.Permalink}}">
<div class="cardContent">
{{ if .Params.image }}
<img class="cardImage {{ if eq .Params.image.cover false }} noCover {{ end }}" alt="{{ .Params.image.alt }}" src="{{ .Params.image.url }}" />
{{ $style := "cardImage {{if ne .Params.image.cover }} noCover {{ end }}" }}
{{- partial "components/image.html" (dict "style" $style "url" .Params.image.url "alt" .Params.image.alt) -}}
{{ else }}
<img class="cardImage" src="{{ .Site.Params.defaultimage }}" alt="Default Image" />
{{- partial "components/image.html" (dict "style" "cardImage" "url" .Site.Params.defaultimage "alt" "Placeholder") -}}
{{ end }}
<div class="cardTitle">{{.Title}}</div>
<div class="cardDescription">{{ .Summary | safeHTML | truncate 320 }}</div>
@ -50,4 +51,4 @@
{{ end }}
</div>
</div>
{{ end }}
{{ end }}