small fixes

This commit is contained in:
teldra 2022-04-07 16:31:15 +02:00
parent 4eb4c72728
commit 9c238619e5
15 changed files with 159 additions and 92 deletions

View File

@ -31,6 +31,7 @@ featured = 'featured'
#do you want a contact page?
contact = true
#do you want an archive?
archive = true

View File

@ -1,10 +1,12 @@
---
title: "Food Saving"
date: "2021-02-04T19:00:00+02:00"
date: "2021-04-06T19:00:00+02:00"
lastmod: "2021-04-06T19:00:00+02:00"
about: true
when: "Jeden Mittwoch 18:30-19:00Uhr & Samstags 15:00-15:30Uhr"
events: ["Regelmäßig"]
contact: "foodsavingcelle@riseup.net"
featured: true
---
Die **kostenfreie** Verteilung von gespendeten und geretteten **Lebensmitteln** geht auch nach der Wiedereröffnung der Tafel weiter.
Spenden? Mitmachen? Wer **mitmachen** oder uns unterstützen möchte, kann sich per Mail melden, sodass wir bei Bedarf nachfragen können.

View File

@ -1,6 +1,8 @@
---
title: "Zeitungsprojekt Revista"
date: "1993-09-04T19:00:00+02:00"
lastmod: "2022-04-04T19:00:00+02:00"
featured: true
about: true
---
Was ist Revista? Revista ist spanisch und heißt Zeitung, und genau das sind wir, eine Zeitung. Die revista ist ein relativ neues Projekt, die erste Ausgabe erschien um Oktober 1999.
@ -25,4 +27,4 @@ c/o Buntes Haus
Hannoversche Str. 30F
29221 Celle
Oder schreibt einfach eine Email an: revista.celle (at) gmx.de
Oder schreibt einfach eine Email an: revista.celle (at) gmx.de

View File

@ -7,6 +7,7 @@
{{ end }}
{{ define "main" }}
{{ if site.Params.debug }}archive.html{{ end }}
<article>
{{ $prev := 3000}}
{{range where .Site.RegularPages "Type" "in" site.Params.searchSections }}
@ -21,4 +22,4 @@
{{ $prev = $date.Format "2006"}}
{{end}}
</article>
{{ end }}
{{ end }}

View File

@ -1 +0,0 @@
asdasd

View File

@ -7,6 +7,7 @@
{{ end }}
{{ define "main" }}
{{ if site.Params.debug }}contact.html{{ end }}
{{- $pic := index (.Resources.ByType "image") 0 -}}
<article>

View File

@ -7,13 +7,14 @@
{{ end }}
{{ define "main" }}
{{ if .Resources.ByType "image" }}
<div style="clear:both;"></div>
<div style="max-width: 25ch; padding: 0 0.8em 0.2em 0; float: right;">
{{ if site.Params.debug }}imprint.html{{ end }}
{{ if .Resources.ByType "image" }}
<div style="clear:both;"></div>
<div style="max-width: 25ch; padding: 0 0.8em 0.2em 0; float: right;">
{{ range .Resources.ByType "image" }}
<a href="{{- .Permalink -}}"><img src="{{- .Permalink -}}"/></a>
{{- end -}}
{{ range .Resources.ByType "image" }}
<a href="{{- .Permalink -}}"><img src="{{- .Permalink -}}"/></a>
{{- end -}}
{{ end }}
{{ if .Resources.ByType "image" }}

View File

@ -1,41 +0,0 @@
{{- define "title" -}}
{{ $name := .Name | lower }}
{{ if ne ($name | i18n) "" }}
{{ $name = $name | i18n }}
{{ else }}
{{ if ne .Section "events" }}
{{ $name = $name | singularize }}
{{ end }}
{{ $name = $name | humanize }}
{{ end }}
<h1>{{ $name }}</h1>
{{- end -}}
{{- define "main" -}}
{{ $title := lower .Title }}
{{ $s := .Site.Params }}
{{- $paginator := slice -}}
{{ $what := printf ".Params.%s" $title }}
{{ if or (eq $title "about") (eq $title "featured") }}
{{- $paginator = .Paginate (where (where .Site.RegularPages "Type" "in" site.Params.searchSections) $what "eq" true) -}}
{{ else if eq $title "events" }}
{{- $paginator = .Paginate (where (where .Site.RegularPages "Type" "in" site.Params.searchSections) ".Params.when" "ne" nil) -}}
{{ else }}
{{- $paginator = .Paginate .Data.Pages -}}
{{ end }}
{{ if eq $paginator.PageNumber 1 }}
{{ if ne .Content "" }}
<article>
{{ .Content }}
</article>
{{ end }}
{{ end }}
{{- range first 5 $paginator.Pages.ByLastmod.Reverse -}}
{{ partial "contentlayouts/list.html" . }}
{{- end }}
{{ partial "structure/paginator" (dict "paginator" $paginator) }}
{{- end -}}
{{ define "sidebar" }}
{{- partial "contentlayouts/menu.html" . }}
{{ end }}

View File

@ -3,9 +3,10 @@
{{ end }}
{{ define "main" }}
{{ if site.Params.debug }}misc.html{{ end }}
<article>
{{ range .Pages }}
<a href="{{ .Permalink }}">{{ .Name }}</a><br>
{{ end }}
</article>
{{ end }}
{{ end }}

View File

@ -0,0 +1,31 @@
{{- define "title" -}}
{{ $name := .Name | lower }}
{{ if ne ($name | i18n) "" }}
{{ $name = $name | i18n }}
{{ else }}
{{ if ne .Section "events" }}
{{ $name = $name | singularize }}
{{ end }}
{{ $name = $name | humanize }}
{{ end }}
<h1>{{ $name }}</h1>
{{- end -}}
{{- define "main" -}}
{{ partial "debug" (dict "context" . "filename" "news.html") }}
{{- $paginator := .Paginate .Data.Pages -}}
{{ if eq $paginator.PageNumber 1 }}
{{ if ne .Content "" }}
<article>
{{ .Content }}
</article>
{{ end }}
{{ end }}
{{ partial "contentlayouts/list.html" (dict "context" . "paginator" $paginator "amount" "5") }}
{{ partial "structure/paginator" (dict "paginator" $paginator) }}
{{- end -}}
{{ define "sidebar" }}
{{- partial "contentlayouts/menu.html" . }}
{{ end }}

View File

@ -12,16 +12,24 @@
{{- end -}}
{{- define "main" -}}
{{ if site.Params.debug }}taxonomy.html{{ end }}
{{ $title := lower .Title }}
{{ $s := .Site.Params }}
{{ $title }}
{{- $paginator := slice -}}
{{ $what := printf ".Params.%s" $title }}
{{ $partial := "contentlayouts/list.html" }}
{{ $what := printf ".Params.%s" $title }}
{{- $posts := where (where .Site.RegularPages "Permalink" "!=" .Permalink) "Type" "in" .Site.Params.searchSections }}
{{ if or (eq $title "about") (eq $title "featured") }}
{{- $paginator = .Paginate (where (where .Site.RegularPages "Type" "in" site.Params.searchSections) $what "eq" true) -}}
{{- $paginator = .Paginate (where $posts $what "eq" true) -}}
{{ else if or (eq $title "tags") (eq $title "categories") }}
{{- $paginator = .Paginate $posts -}}
{{ $partial = "contentlayouts/termlist.html" }}
{{ else if eq $title "events" }}
{{- $paginator = .Paginate (where (where .Site.RegularPages "Type" "in" site.Params.searchSections) ".Params.when" "ne" nil) -}}
{{ else }}
{{- $paginator = .Paginate .Data.Pages -}}
{{- $paginator = .Paginate (where $posts ".Params.when" "ne" nil) -}}
{{ else }}
{{- $paginator = .Paginate .Data.Pages -}}
{{ end }}
{{ if eq $paginator.PageNumber 1 }}
{{ if ne .Content "" }}
@ -30,9 +38,7 @@
</article>
{{ end }}
{{ end }}
{{- range first 5 $paginator.Pages.ByLastmod.Reverse -}}
{{ partial "contentlayouts/list.html" . }}
{{- end }}
{{ partial $partial (dict "context" . "paginator" $paginator "amount" "5") }}
{{ partial "structure/paginator" (dict "paginator" $paginator) }}
{{- end -}}

View File

@ -5,35 +5,33 @@
{{ end }}
{{ define "main" }}
{{ now }}<br>
{{ $diffp := now.AddDate 0 0 14 }}
{{ $diffn := now.AddDate 0 0 -14 }}
{{ $diffp }}<br>
{{ $diffn }}<br>
{{ partial "debug" (dict "context" . "filename" "index.html") }}
<!-- <a href="/news"><h2>{{ "news" | T }}</h2></a> -->
{{ $s := .Site.Params }}
{{ $meta := false }}
{{- $posts := where (where .Site.RegularPages "Permalink" "!=" .Permalink) "Type" "in" $s.searchSections }}
{{- $featured := where (where $posts ".Params.featured" "=" true) "Type" "in" $s.searchSections }}
{{- $paginator := slice -}}
{{- $paginator = .Paginate $posts.ByDate.Reverse -}}
<!-- <a href="/featured"><h2>{{ "featured" | T }}</h2></a> -->
{{- $paginator := .Paginate $posts -}}
{{ if eq $paginator.PageNumber 1 }}
{{ if ne .Content "" }}
<article>
{{ .Content }}
</article>
{{ end }}
{{ range first 3 $featured.ByLastmod.Reverse }}
{{ $article_age := sub now.Unix (int .Date.Unix) }}
{{ if lt $article_age "1209600" }}
{{ partial "contentlayouts/list.html" . }}
{{ end }}
{{ end }}
<a href="/featured"><h2>{{ "featured" | T }}</h2></a>
{{ partial "contentlayouts/list.html" (dict "context" . "pages" $featured "amount" "3" "max_age" "3" "featured" "true") }}
{{ end }}
{{- range first 5 $paginator.Pages.ByLastmod.Reverse -}}
{{ $article_age := sub now.Unix (int .Date.Unix) }}
{{ if or (ne .Params.featured true) (ge $article_age "1209600") }}
{{ partial "contentlayouts/list.html" . }}
{{ end }}
{{- end }}
<a href="/news"><h2>{{ "news" | T }}</h2></a>
{{ partial "contentlayouts/list.html" (dict "context" . "paginator" $paginator "amount" "5" "max_age" "-14") }}
<div id="pagination_outer" style="display: flex; justify-content: center;">
{{ partial "structure/paginator" (dict "paginator" $paginator) }}
</div>

View File

@ -1,14 +1,44 @@
{{ if .Title }}
<article class="articlebgcol1 borderrad25">
<a href="{{- .Permalink -}}">
<div id="articletitle">
<h2>{{- .Title -}}</h2>
</div>
</a>
<a href="{{- .Permalink -}}">
<div id="articlecontent">
{{ partial "contentlayouts/article.html" (dict "context" . "type" "list") }}
</div>
</a>
</article>
{{ if or .paginator .pages }}
{{ if .amount }}
{{ $amount := .amount }}
{{ $pages := "" }}
{{ $max_age := int .max_age }}
{{ $featured := .featured }}
{{ if .pages }}
{{ $pages = .pages.ByLastmod.Reverse }}
{{ else if .paginator }}
{{ $pages = .paginator.Pages.ByLastmod.Reverse }}
{{ end }}
{{- range first $amount $pages -}}
{{ $true := true }}
{{ if $featured }}
{{ if le (.Lastmod.AddDate 0 0 $max_age) now }}
{{ $true = false }}
{{ end }}
{{ else }}
{{ if $max_age }}
{{ if and (lt (.Lastmod.AddDate 0 0 $max_age) now) (eq .Params.featured true) }}
{{ $true = false }}
{{ end }}
{{ end }}
{{ end }}
{{ if eq $true true }}
{{ if .Title }}
<article class="articlebgcol1 borderrad25">
<a href="{{- .Permalink -}}">
<div id="articletitle">
<h2>{{- .Title -}}</h2>
</div>
</a>
<a href="{{- .Permalink -}}">
<div id="articlecontent">
{{ partial "contentlayouts/article.html" (dict "context" . "type" "list") }}
</div>
</a>
</article>
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}

View File

@ -0,0 +1,29 @@
{{ $name := .context.Title }}
{{ $title := lower .context.Title }}
{{ range $taxonomyname, $taxonomy := .context.Site.Taxonomies }}
{{ if eq $title $taxonomyname }}
{{ range $key, $value := $taxonomy }}
<a href="{{ printf "%s" $key }}">{{ $key }}</a>
{{ end }}
{{ end }}
{{ end }}
{{ if and site.Params.debug false }}
{{ range $taxonomyname, $taxonomy := .context.Site.Taxonomies }}
<li><a href="/{{ $taxonomyname | urlize }}">{{ $taxonomyname }}</a>
<ul>
{{ range $key, $value := $taxonomy }}
<li> {{ $key }} </li>
<ul>
{{ range $value.Pages }}
<li hugo-nav="{{ .RelPermalink}}"><a href="{{ .Permalink}}"> {{ .LinkTitle }} </a> </li>
{{ end }}
</ul>
{{ end }}
</ul>
</li>
{{ end }}
{{ end }}

View File

@ -0,0 +1,6 @@
{{ if site.Params.debug }}
Title: {{ .context.Title }}<br>
Name: {{ .context.Name }}<br>
context: {{ .context }}<br>
filename: {{ .filename }}<br>
{{ end }}