CHANGE from config to md files for index page

This commit is contained in:
Hoernschen 2023-11-19 17:11:04 +01:00
parent 80feba5acc
commit db7ec5795f
Signed by: hoernschen
GPG key ID: 37591FAF4E6D3462
12 changed files with 37 additions and 54 deletions

View file

@ -14,20 +14,27 @@
{{ end }} {{ end }}
{{- range $index, $page := .Pages }} {{- range $index, $page := .Pages }}
{{ $odd := mod $index 2 }} {{ $odd := mod $index 2 }}
{{ $id := .Params.id | default $page.File.ContentBaseName }}
{{ if eq .Params.type "slider" }} {{ 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" }} {{ 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" }} {{ 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" }} {{ 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" }} {{ 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" }} {{ 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" }} {{ 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 }} {{ end }}
{{ end }} {{ end }}

View file

@ -1,25 +0,0 @@
{{ define "main" }}
<div class="header-blocker"></div>
{{- 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 }}

View file

@ -1,9 +1,9 @@
{{- $contact := .contact }} {{- $contact := .contact }}
{{- $id := "contact"}} {{- $id := "contact"}}
{{if $contact.id}} {{if $contact.id}}
{{- $id := $contact.id}} {{- $id = $contact.id}}
{{else if .id}} {{else if .id}}
{{- $id := .id }} {{- $id = .id }}
{{end}} {{end}}
<div id="{{ $id }}" class="section section-highlight"> <div id="{{ $id }}" class="section section-highlight">
<div class="section-content contact"> <div class="section-content contact">

View file

@ -1,4 +1,5 @@
{{- $hero := .hero }} {{- $hero := .hero }}
{{- $content := .content }}
{{- $color := .color }} {{- $color := .color }}
{{- $odd := .odd }} {{- $odd := .odd }}
{{- $id := "hero"}} {{- $id := "hero"}}
@ -19,7 +20,7 @@
<h1 class="content-title">{{ $hero.title }}</h1> <h1 class="content-title">{{ $hero.title }}</h1>
<div class="divider"></div> <div class="divider"></div>
</div> </div>
<p>{{ $hero.subtitle }}</p> <p>{{ $content }}</p>
{{if $hero.button.visible}} {{if $hero.button.visible}}
<a class="hero-button" href="{{ $hero.button.url }}">{{ $hero.button.text }}</a> <a class="hero-button" href="{{ $hero.button.url }}">{{ $hero.button.text }}</a>
{{end}} {{end}}

View file

@ -3,9 +3,9 @@
{{- $defaultimage := .defaultimage}} {{- $defaultimage := .defaultimage}}
{{- $id := "links"}} {{- $id := "links"}}
{{if $links.id}} {{if $links.id}}
{{- $id := $links.id}} {{- $id = $links.id}}
{{else if .id}} {{else if .id}}
{{- $id := .id }} {{- $id = .id }}
{{end}} {{end}}
<div id="{{ $id }}" class="section {{if eq $odd 0}} section-even {{end}}"> <div id="{{ $id }}" class="section {{if eq $odd 0}} section-even {{end}}">
<div class="section-content"> <div class="section-content">

View file

@ -2,9 +2,9 @@
{{- $odd := .odd }} {{- $odd := .odd }}
{{- $id := "logos"}} {{- $id := "logos"}}
{{if $logos.id}} {{if $logos.id}}
{{- $id := $logos.id}} {{- $id = $logos.id}}
{{else if .id}} {{else if .id}}
{{- $id := .id }} {{- $id = .id }}
{{end}} {{end}}
<div id="{{ $id }}" class="section {{if eq $odd 0}} section-even {{end}}"> <div id="{{ $id }}" class="section {{if eq $odd 0}} section-even {{end}}">
<div class="section-content funding"> <div class="section-content funding">

View file

@ -4,9 +4,9 @@
{{- $odd := .odd }} {{- $odd := .odd }}
{{- $id := "posts"}} {{- $id := "posts"}}
{{if $posts.id}} {{if $posts.id}}
{{- $id := $posts.id}} {{- $id = $posts.id}}
{{else if .id}} {{else if .id}}
{{- $id := .id }} {{- $id = .id }}
{{end}} {{end}}
<div id="{{ $id }}" class="section {{if eq $odd 0}} section-even {{end}}"> <div id="{{ $id }}" class="section {{if eq $odd 0}} section-even {{end}}">
<div class="section-content posts"> <div class="section-content posts">

View file

@ -3,9 +3,9 @@
{{- $odd := .odd }} {{- $odd := .odd }}
{{- $id := "service"}} {{- $id := "service"}}
{{if $service.id}} {{if $service.id}}
{{- $id := $service.id}} {{- $id = $service.id}}
{{else if .id}} {{else if .id}}
{{- $id := .id }} {{- $id = .id }}
{{end}} {{end}}
<div id="{{$id}}" class="section {{if eq $odd 0}} section-even {{end}} row"> <div id="{{$id}}" class="section {{if eq $odd 0}} section-even {{end}} row">
<div class="section-content services"> <div class="section-content services">

View file

@ -3,9 +3,9 @@
{{ $length := len $slider.images }} {{ $length := len $slider.images }}
{{- $id := "slider"}} {{- $id := "slider"}}
{{if $slider.id}} {{if $slider.id}}
{{- $id := $slider.id}} {{- $id = $slider.id}}
{{else if .id}} {{else if .id}}
{{- $id := .id }} {{- $id = .id }}
{{end}} {{end}}
{{ $template := resources.Get "scss/slider.scss" }} {{ $template := resources.Get "scss/slider.scss" }}
{{ if $template }} {{ if $template }}

View file

@ -4,9 +4,9 @@
{{- $odd := .odd }} {{- $odd := .odd }}
{{- $id := "team"}} {{- $id := "team"}}
{{if $team.id}} {{if $team.id}}
{{- $id := $team.id}} {{- $id = $team.id}}
{{else if .id}} {{else if .id}}
{{- $id := .id }} {{- $id = .id }}
{{end}} {{end}}
<div id="{{ $id }}" class="section {{if eq $odd 0}} section-even {{end}}"> <div id="{{ $id }}" class="section {{if eq $odd 0}} section-even {{end}}">
<div class="section-content team"> <div class="section-content team">

View file

@ -2,9 +2,9 @@
{{- $odd := .odd }} {{- $odd := .odd }}
{{- $id := "video"}} {{- $id := "video"}}
{{if $video.id}} {{if $video.id}}
{{- $id := $video.id}} {{- $id = $video.id}}
{{else if .id}} {{else if .id}}
{{- $id := .id }} {{- $id = .id }}
{{end}} {{end}}
<div id="{{ $id }}" class="section {{if eq $odd 0}} section-even {{end}}"> <div id="{{ $id }}" class="section {{if eq $odd 0}} section-even {{end}}">
<div class="section-content"> <div class="section-content">