From db7ec5795f764fe318916e24d99b7bc85a3db2ad Mon Sep 17 00:00:00 2001 From: Hoernschen Date: Sun, 19 Nov 2023 17:11:04 +0100 Subject: [PATCH] CHANGE from config to md files for index page --- layouts/_default/list.html | 21 ++++++++++++++------- layouts/index.html | 25 ------------------------- layouts/partials/contact.html | 4 ++-- layouts/partials/footer.html | 6 +++--- layouts/partials/hero.html | 3 ++- layouts/partials/links.html | 6 +++--- layouts/partials/logos.html | 6 +++--- layouts/partials/posts.html | 4 ++-- layouts/partials/service.html | 4 ++-- layouts/partials/slider.html | 4 ++-- layouts/partials/team.html | 4 ++-- layouts/partials/video.html | 4 ++-- 12 files changed, 37 insertions(+), 54 deletions(-) delete mode 100644 layouts/index.html diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 4aef137..d349f6c 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -14,20 +14,27 @@ {{ end }} {{- range $index, $page := .Pages }} {{ $odd := mod $index 2 }} + {{ $id := .Params.id | default $page.File.ContentBaseName }} {{ if eq .Params.type "slider" }} - {{- partial "slider.html" (dict "id" $page.File.ContentBaseName "slider" .Params "color" $.Site.Params.color "odd" $odd) -}} + {{- partial "slider.html" (dict "id" $id "slider" .Params "color" $.Site.Params.color "odd" $odd) -}} {{ else if eq .Params.type "hero" }} - {{- partial "hero.html" (dict "id" $page.File.ContentBaseName "hero" .Params "color" $.Site.Params.color "odd" $odd) -}} + {{- partial "hero.html" (dict "id" $id "hero" .Params "content" .Content "color" $.Site.Params.color "odd" $odd) -}} {{ else if eq .Params.type "video" }} - {{- partial "video.html" (dict "id" $page.File.ContentBaseName "video" .Params "odd" $odd) -}} + {{- partial "video.html" (dict "id" $id "video" .Params "odd" $odd) -}} {{ else if eq .Params.type "service" }} - {{- partial "service.html" (dict "id" $page.File.ContentBaseName "service" .Params "content" .Content "odd" $odd) -}} + {{- partial "service.html" (dict "id" $id "service" .Params "content" .Content "odd" $odd) -}} + {{ else if eq .Params.type "team" }} + {{ $pages := where $.Site.RegularPages "Section" $id }} + {{- partial "team.html" (dict "id" $id "team" .Params "pages" $pages "defaultimage" $.Site.Params.defaultimage "odd" $odd) -}} {{ else if eq .Params.type "contact" }} - {{- partial "contact.html" (dict "id" $page.File.ContentBaseName "contact" .Params "odd" $odd) -}} + {{- partial "contact.html" (dict "id" $id "contact" .Params "odd" $odd) -}} {{ else if eq .Params.type "logos" }} - {{- partial "logos.html" (dict "id" $page.File.ContentBaseName "logos" .Params "odd" $odd) -}} + {{- partial "logos.html" (dict "id" $id "logos" .Params "odd" $odd) -}} {{ else if eq .Params.type "links" }} - {{- partial "links.html" (dict "id" $page.File.ContentBaseName "links" .Params "defaultimage" $.Site.Params.defaultimage "odd" $odd) -}} + {{- partial "links.html" (dict "id" $id "links" .Params "defaultimage" $.Site.Params.defaultimage "odd" $odd) -}} + {{ else if eq .Params.type "posts" }} + {{ $pages := where $.Site.RegularPages "Section" $id }} + {{- partial "posts.html" (dict "id" $id "posts" .Params "pages" $pages "defaultimage" $.Site.Params.defaultimage "odd" $odd) -}} {{ end }} {{ end }} {{ end }} \ No newline at end of file diff --git a/layouts/index.html b/layouts/index.html deleted file mode 100644 index 96cd4fa..0000000 --- a/layouts/index.html +++ /dev/null @@ -1,25 +0,0 @@ -{{ define "main" }} -
- {{- range $index, $section := .Site.Params.sections }} - {{ $odd := mod $index 2 }} - {{ if eq .type "slider" }} - {{- partial "slider.html" (dict "slider" $section "color" $.Site.Params.color "odd" $odd) -}} - {{ else if eq .type "hero" }} - {{- partial "hero.html" (dict "hero" $section "color" $.Site.Params.color "odd" $odd) -}} - {{ else if eq .type "video" }} - {{- partial "video.html" (dict "video" $section "odd" $odd) -}} - {{ else if eq .type "service" }} - {{- partial "service.html" (dict "service" $section "content" $section.description "odd" $odd) -}} - {{ else if eq .type "team" }} - {{ $pages := where $.Site.RegularPages "Section" $section.id }} - {{- partial "team.html" (dict "team" $section "pages" $pages "defaultimage" $.Site.Params.defaultimage "odd" $odd) -}} - {{ else if eq .type "contact" }} - {{- partial "contact.html" (dict "contact" $section "odd" $odd) -}} - {{ else if eq .type "logos" }} - {{- partial "logos.html" (dict "logos" $section "odd" $odd) -}} - {{ else if eq .type "posts" }} - {{ $pages := where $.Site.RegularPages "Section" $section.id }} - {{- partial "posts.html" (dict "posts" $section "pages" $pages "defaultimage" $.Site.Params.defaultimage "odd" $odd) -}} - {{ end }} - {{- end }} -{{ end }} \ No newline at end of file diff --git a/layouts/partials/contact.html b/layouts/partials/contact.html index 4779a01..479e3ba 100644 --- a/layouts/partials/contact.html +++ b/layouts/partials/contact.html @@ -1,9 +1,9 @@ {{- $contact := .contact }} {{- $id := "contact"}} {{if $contact.id}} - {{- $id := $contact.id}} + {{- $id = $contact.id}} {{else if .id}} - {{- $id := .id }} + {{- $id = .id }} {{end}}
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 3f83357..c82ed56 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,6 +1,6 @@ -{{- $footer := .Site.Params.footer }} -{{- $social := index $footer "social" }} -{{- $links := index $footer "links" }} +{{- $footer := .Site.Params.footer }} +{{- $social := index $footer "social" }} +{{- $links := index $footer "links" }} {{ $template := resources.Get "scss/footer.scss" }} {{ if $template }} {{ $footer := $template | resources.ExecuteAsTemplate "css/footer.scss" . | resources.ToCSS (dict "outputStyle" "compressed") | fingerprint }} diff --git a/layouts/partials/hero.html b/layouts/partials/hero.html index 92ecbd5..63a2897 100644 --- a/layouts/partials/hero.html +++ b/layouts/partials/hero.html @@ -1,4 +1,5 @@ {{- $hero := .hero }} +{{- $content := .content }} {{- $color := .color }} {{- $odd := .odd }} {{- $id := "hero"}} @@ -19,7 +20,7 @@

{{ $hero.title }}

-

{{ $hero.subtitle }}

+

{{ $content }}

{{if $hero.button.visible}} {{ $hero.button.text }} {{end}} diff --git a/layouts/partials/links.html b/layouts/partials/links.html index ece96f8..6047415 100644 --- a/layouts/partials/links.html +++ b/layouts/partials/links.html @@ -1,11 +1,11 @@ {{- $links := .links }} -{{- $odd := .odd }} +{{- $odd := .odd }} {{- $defaultimage := .defaultimage}} {{- $id := "links"}} {{if $links.id}} - {{- $id := $links.id}} + {{- $id = $links.id}} {{else if .id}} - {{- $id := .id }} + {{- $id = .id }} {{end}}
diff --git a/layouts/partials/logos.html b/layouts/partials/logos.html index 87ee60e..e60aa28 100644 --- a/layouts/partials/logos.html +++ b/layouts/partials/logos.html @@ -1,10 +1,10 @@ {{- $logos := .logos }} -{{- $odd := .odd }} +{{- $odd := .odd }} {{- $id := "logos"}} {{if $logos.id}} - {{- $id := $logos.id}} + {{- $id = $logos.id}} {{else if .id}} - {{- $id := .id }} + {{- $id = .id }} {{end}}
diff --git a/layouts/partials/posts.html b/layouts/partials/posts.html index f382cbc..d09905d 100644 --- a/layouts/partials/posts.html +++ b/layouts/partials/posts.html @@ -4,9 +4,9 @@ {{- $odd := .odd }} {{- $id := "posts"}} {{if $posts.id}} - {{- $id := $posts.id}} + {{- $id = $posts.id}} {{else if .id}} - {{- $id := .id }} + {{- $id = .id }} {{end}}
diff --git a/layouts/partials/service.html b/layouts/partials/service.html index 2d4cfe8..504cb1d 100644 --- a/layouts/partials/service.html +++ b/layouts/partials/service.html @@ -3,9 +3,9 @@ {{- $odd := .odd }} {{- $id := "service"}} {{if $service.id}} - {{- $id := $service.id}} + {{- $id = $service.id}} {{else if .id}} - {{- $id := .id }} + {{- $id = .id }} {{end}}
diff --git a/layouts/partials/slider.html b/layouts/partials/slider.html index f89b439..8a7e38d 100644 --- a/layouts/partials/slider.html +++ b/layouts/partials/slider.html @@ -3,9 +3,9 @@ {{ $length := len $slider.images }} {{- $id := "slider"}} {{if $slider.id}} - {{- $id := $slider.id}} + {{- $id = $slider.id}} {{else if .id}} - {{- $id := .id }} + {{- $id = .id }} {{end}} {{ $template := resources.Get "scss/slider.scss" }} {{ if $template }} diff --git a/layouts/partials/team.html b/layouts/partials/team.html index e8332c3..acacb8d 100644 --- a/layouts/partials/team.html +++ b/layouts/partials/team.html @@ -4,9 +4,9 @@ {{- $odd := .odd }} {{- $id := "team"}} {{if $team.id}} - {{- $id := $team.id}} + {{- $id = $team.id}} {{else if .id}} - {{- $id := .id }} + {{- $id = .id }} {{end}}
diff --git a/layouts/partials/video.html b/layouts/partials/video.html index c2e847f..a799a54 100644 --- a/layouts/partials/video.html +++ b/layouts/partials/video.html @@ -2,9 +2,9 @@ {{- $odd := .odd }} {{- $id := "video"}} {{if $video.id}} - {{- $id := $video.id}} + {{- $id = $video.id}} {{else if .id}} - {{- $id := .id }} + {{- $id = .id }} {{end}}