+ {{ if site.Params.debug }}imprint.html{{ end }}
+ {{ if .Resources.ByType "image" }}
+
- {{ range .Resources.ByType "image" }}
-
- {{- end -}}
+ {{ range .Resources.ByType "image" }}
+
+ {{- end -}}
{{ end }}
{{ if .Resources.ByType "image" }}
diff --git a/themes/buha/layouts/_default/list.html b/themes/buha/layouts/_default/list.html
deleted file mode 100644
index 506ee1b..0000000
--- a/themes/buha/layouts/_default/list.html
+++ /dev/null
@@ -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 }}
-
{{ $name }}
-{{- 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 "" }}
-
- {{ .Content }}
-
- {{ 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 }}
diff --git a/themes/buha/layouts/_default/misc.html b/themes/buha/layouts/_default/misc.html
index 42d16b5..00eabb2 100644
--- a/themes/buha/layouts/_default/misc.html
+++ b/themes/buha/layouts/_default/misc.html
@@ -3,9 +3,10 @@
{{ end }}
{{ define "main" }}
+ {{ if site.Params.debug }}misc.html{{ end }}
{{ range .Pages }}
{{ .Name }}
{{ end }}
-{{ end }}
\ No newline at end of file
+{{ end }}
diff --git a/themes/buha/layouts/_default/news.html b/themes/buha/layouts/_default/news.html
new file mode 100644
index 0000000..2fbe9eb
--- /dev/null
+++ b/themes/buha/layouts/_default/news.html
@@ -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 }}
+
{{ $name }}
+{{- end -}}
+
+{{- define "main" -}}
+ {{ partial "debug" (dict "context" . "filename" "news.html") }}
+ {{- $paginator := .Paginate .Data.Pages -}}
+
+ {{ if eq $paginator.PageNumber 1 }}
+ {{ if ne .Content "" }}
+
+ {{ .Content }}
+
+ {{ 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 }}
diff --git a/themes/buha/layouts/_default/taxonomy.html b/themes/buha/layouts/_default/taxonomy.html
index 506ee1b..70413bf 100644
--- a/themes/buha/layouts/_default/taxonomy.html
+++ b/themes/buha/layouts/_default/taxonomy.html
@@ -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 @@
{{ 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 -}}
diff --git a/themes/buha/layouts/index.html b/themes/buha/layouts/index.html
index 0d6121c..643b270 100644
--- a/themes/buha/layouts/index.html
+++ b/themes/buha/layouts/index.html
@@ -5,35 +5,33 @@
{{ end }}
{{ define "main" }}
+ {{ now }}
+ {{ $diffp := now.AddDate 0 0 14 }}
+ {{ $diffn := now.AddDate 0 0 -14 }}
+ {{ $diffp }}
+ {{ $diffn }}
+
+
+
+ {{ partial "debug" (dict "context" . "filename" "index.html") }}
-
-
{{ $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 -}}
-
+ {{- $paginator := .Paginate $posts -}}
{{ if eq $paginator.PageNumber 1 }}
{{ if ne .Content "" }}
{{ .Content }}
{{ 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 }}
+
{{ "featured" | T }}
+ {{ 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 }}
+
{{ "news" | T }}
+
+ {{ partial "contentlayouts/list.html" (dict "context" . "paginator" $paginator "amount" "5" "max_age" "-14") }}
+
diff --git a/themes/buha/layouts/partials/contentlayouts/list.html b/themes/buha/layouts/partials/contentlayouts/list.html
index fd0149e..ddb41d9 100644
--- a/themes/buha/layouts/partials/contentlayouts/list.html
+++ b/themes/buha/layouts/partials/contentlayouts/list.html
@@ -1,14 +1,44 @@
-{{ if .Title }}
-
-
-
-
{{- .Title -}}
-
-
-
-
- {{ partial "contentlayouts/article.html" (dict "context" . "type" "list") }}
-
-
-
+{{ 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 }}
+
+
+
+
{{- .Title -}}
+
+
+
+
+ {{ partial "contentlayouts/article.html" (dict "context" . "type" "list") }}
+
+
+
+ {{ end }}
+ {{ end }}
+ {{ end }}
+ {{ end }}
{{ end }}
diff --git a/themes/buha/layouts/partials/contentlayouts/termlist.html b/themes/buha/layouts/partials/contentlayouts/termlist.html
new file mode 100644
index 0000000..39ac2a9
--- /dev/null
+++ b/themes/buha/layouts/partials/contentlayouts/termlist.html
@@ -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 }}
+
{{ $key }}
+ {{ end }}
+ {{ end }}
+{{ end }}
+
+
+{{ if and site.Params.debug false }}
+ {{ range $taxonomyname, $taxonomy := .context.Site.Taxonomies }}
+
{{ $taxonomyname }}
+
+ {{ range $key, $value := $taxonomy }}
+ - {{ $key }}
+
+ {{ end }}
+
+
+ {{ end }}
+{{ end }}
diff --git a/themes/buha/layouts/partials/debug.html b/themes/buha/layouts/partials/debug.html
new file mode 100644
index 0000000..adcd05b
--- /dev/null
+++ b/themes/buha/layouts/partials/debug.html
@@ -0,0 +1,6 @@
+{{ if site.Params.debug }}
+Title: {{ .context.Title }}
+Name: {{ .context.Name }}
+context: {{ .context }}
+filename: {{ .filename }}
+{{ end }}