refactoring[layout]!: improve submodules, make them configurable
* Fix: defines images alt text through file * Homepage layout: single elements can be enabled/disabled * Widgets: dehardcodes title. As a consequence, configuration files have been renamed, widgets are now totally "generic" and could be reused BREAKING CHANGES: requires new configuration file for home layout. Old configuration file have been renamed due to dehardcoding. Closes: #4 #18 Conflicts: pull #13 Kudos: @Zekromaster for the dehardcoding
This commit is contained in:
parent
72fe5a6148
commit
8d7070cf67
|
@ -1,6 +1,10 @@
|
||||||
|
title = "Projects"
|
||||||
|
id = "projects"
|
||||||
|
|
||||||
[[list]]
|
[[list]]
|
||||||
title = "lorem"
|
title = "lorem"
|
||||||
image = "https://picsum.photos/400/200"
|
image = "https://picsum.photos/400/200"
|
||||||
|
imageAlt = "Random image from Picsum"
|
||||||
text = """
|
text = """
|
||||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
|
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
|
||||||
Voluptatibus quia, nulla! Maiores et perferendis eaque,
|
Voluptatibus quia, nulla! Maiores et perferendis eaque,
|
||||||
|
@ -9,6 +13,7 @@
|
||||||
[[list]]
|
[[list]]
|
||||||
title = "lorem"
|
title = "lorem"
|
||||||
image = "https://picsum.photos/400/200"
|
image = "https://picsum.photos/400/200"
|
||||||
|
imageAlt = "Random image from Picsum"
|
||||||
text = """
|
text = """
|
||||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
|
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
|
||||||
Voluptatibus quia, nulla! Maiores et perferendis eaque,
|
Voluptatibus quia, nulla! Maiores et perferendis eaque,
|
|
@ -1,3 +1,6 @@
|
||||||
|
title = "Skills"
|
||||||
|
id = "skills"
|
||||||
|
|
||||||
[[list]]
|
[[list]]
|
||||||
name = "go"
|
name = "go"
|
||||||
icon = "https://devicons.github.io/devicon/devicon.git/icons/go/go-original.svg"
|
icon = "https://devicons.github.io/devicon/devicon.git/icons/go/go-original.svg"
|
|
@ -1,4 +1,6 @@
|
||||||
title = "Hello, World!"
|
mainTitle = "About Me"
|
||||||
|
secondaryTitle = "Hello, World!"
|
||||||
|
id = "about"
|
||||||
|
|
||||||
text = """
|
text = """
|
||||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
|
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
|
|
@ -0,0 +1,8 @@
|
||||||
|
[[home]]
|
||||||
|
enableWave = "true"
|
||||||
|
enableTopWidget = "true"
|
||||||
|
enableMiddleWidget = "true"
|
||||||
|
enableBottomWidget = "true"
|
||||||
|
|
||||||
|
[[single]]
|
||||||
|
enableWave = "true"
|
|
@ -1,12 +1,24 @@
|
||||||
<div>
|
<div>
|
||||||
|
<!-- Background: if defined, load the image from /config.params.mainbg, else use an image from picsum -->
|
||||||
<div
|
<div
|
||||||
id = "mainBG"
|
id = "mainBG"
|
||||||
style = "background-image: url(' {{ if $.Site.Params.mainbg }} {{ $.Site.Params.mainbg }} {{ else }} https://picsum.photos/1920/1080 {{ end }} ');"
|
style = "background-image: url(' {{ if $.Site.Params.mainbg }} {{ $.Site.Params.mainbg }} {{ else }} https://picsum.photos/1920/1080 {{ end }} ');"
|
||||||
>
|
>
|
||||||
|
|
||||||
{{ partial "utilities/wave" .}}
|
<!-- layouts file variable -->
|
||||||
|
{{ $layouts := .Site.Data.site.layouts }}
|
||||||
|
|
||||||
|
<!-- Wave: load if enabled in data/site/layouts.home.enableWave -->
|
||||||
|
{{ range $layouts.home }}
|
||||||
|
{{if eq .enableWave "true"}}
|
||||||
|
{{ partial "utilities/wave" .}}
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
<!-- Title and maintext, centered on the background image -->
|
||||||
<div class="centerAll">
|
<div class="centerAll">
|
||||||
|
|
||||||
|
<!-- Site title -->
|
||||||
<div class="title text-6xl font-bold text-center">
|
<div class="title text-6xl font-bold text-center">
|
||||||
{{if $.Site.Params.maintitle }}
|
{{if $.Site.Params.maintitle }}
|
||||||
{{ $.Site.Params.maintitle }}
|
{{ $.Site.Params.maintitle }}
|
||||||
|
@ -15,6 +27,7 @@
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Site maintext/description -->
|
||||||
<div class="text text-xl text-center">
|
<div class="text text-xl text-center">
|
||||||
{{if $.Site.Params.maintext}}
|
{{if $.Site.Params.maintext}}
|
||||||
{{ $.Site.Params.maintext }}
|
{{ $.Site.Params.maintext }}
|
||||||
|
@ -22,13 +35,26 @@
|
||||||
Edit config.toml/params
|
Edit config.toml/params
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Page content: load widget only if enabled in data/site/layouts.home -->
|
||||||
<main class="container mx-auto mt-8 px-4 xl:px-0">
|
<main class="container mx-auto mt-8 px-4 xl:px-0">
|
||||||
{{partial "utilities/widgetAbout" .}}
|
{{ range $layouts.home }}
|
||||||
{{partial "utilities/widgetBoxIconText" .}}
|
{{if eq .enableTopWidget "true"}}
|
||||||
{{partial "utilities/widgetBoxImageText" .}}
|
{{partial "utilities/widgetSocial" $.Site}}
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
{{if eq .enableMiddleWidget "true"}}
|
||||||
|
{{partial "utilities/widgetBoxIconText" $.Site}}
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
{{if eq .enableBottomWidget "true"}}
|
||||||
|
{{partial "utilities/widgetBoxImageText" $.Site}}
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
{{ $data := .Site.Data.home }}
|
{{ $data := .Site.Data.home }}
|
||||||
|
|
||||||
<section id="skills" class="mt-12">
|
<section id="{{$data.middle.id}}" class="mt-12">
|
||||||
<div class="md:flex justify-center">
|
<div class="md:flex justify-center">
|
||||||
{{ partial "home/homeTitle" (dict "title" "Skills") }}
|
{{ partial "home/homeTitle" (dict "title" $data.middle.title) }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{if $data.skills.list}}
|
{{if $data.middle.list}}
|
||||||
<div class="mt-8 grid grid-flow-row grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4" >
|
<div class="mt-8 grid grid-flow-row grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4" >
|
||||||
|
|
||||||
{{ range $data.skills.list }}
|
{{ range $data.middle.list }}
|
||||||
<div class="w-full rounded overflow-hidden shadow-lg">
|
<div class="w-full rounded overflow-hidden shadow-lg">
|
||||||
<div class="">
|
<div class="">
|
||||||
<div class="font-bold text-xl mb-2 py-2 px-6 bg-gray-500">
|
<div class="font-bold text-xl mb-2 py-2 px-6 bg-gray-500">
|
||||||
|
@ -34,6 +34,6 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{else}}
|
{{else}}
|
||||||
<div class="mt-4 text-xl text-center">Skills don't exist</div>
|
<div class="mt-4 text-xl text-center">Undefined list</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
{{ $data := .Site.Data.home }}
|
{{ $data := .Site.Data.home }}
|
||||||
|
|
||||||
<section id="projects" class="mt-12">
|
<section id="{{$data.bottom.id}}" class="mt-12">
|
||||||
<div class="md:flex justify-center">
|
<div class="md:flex justify-center">
|
||||||
{{ partial "home/homeTitle" (dict "title" "Projects") }}
|
{{ partial "home/homeTitle" (dict "title" $data.bottom.title) }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{if $data.skills.list}}
|
{{if $data.bottom.list}}
|
||||||
<div class="mt-8 grid grid-flow-row grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
<div class="mt-8 grid grid-flow-row grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||||
{{ range $data.project.list }}
|
{{ range $data.bottom.list }}
|
||||||
<div class="w-full rounded overflow-hidden shadow-lg">
|
<div class="w-full rounded overflow-hidden shadow-lg">
|
||||||
<a href="{{ .url }}" target="_blank">
|
<a href="{{ .url }}" target="_blank">
|
||||||
<img
|
<img
|
||||||
class="w-full h-48"
|
class="w-full h-48"
|
||||||
src="{{ .image }}"
|
src="{{ .image }}"
|
||||||
alt="Sunset in the mountains"
|
alt="{{ .imageAlt }}"
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
<div class="px-6 py-4">
|
<div class="px-6 py-4">
|
||||||
|
@ -27,6 +27,6 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{else}}
|
{{else}}
|
||||||
<div class="mt-4 text-xl text-center">Projects does not exist</div>
|
<div class="mt-4 text-xl text-center">Undefined list</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
{{ $data := .Site.Data.home }}
|
{{ $data := .Site.Data.home }}
|
||||||
|
|
||||||
<section id="about" class="md:flex justify-around">
|
<section id="{{$data.top.id}}" class="md:flex justify-around">
|
||||||
<div class="my-auto md:mr-4">
|
<div class="my-auto md:mr-4">
|
||||||
{{ partial "home/homeTitle" (dict "title" "About Me") }}
|
{{ partial "home/homeTitle" (dict "title" $data.top.mainTitle) }}
|
||||||
|
|
||||||
<div class="flex mt-3 gap-3 text-xl">
|
<div class="flex mt-3 gap-3 text-xl">
|
||||||
{{ range $data.about.link }}
|
{{ range .Site.Data.home.top.link }}
|
||||||
<a href="{{.url}}"><i class="{{ .icon }}"></i></a>{{end}}
|
<a href="{{.url}}"><i class="{{ .icon }}"></i></a>
|
||||||
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -14,16 +15,16 @@
|
||||||
<div class="mt-4 md:mt-0 md:ml-4">
|
<div class="mt-4 md:mt-0 md:ml-4">
|
||||||
|
|
||||||
<div class="text-2xl font-bold">
|
<div class="text-2xl font-bold">
|
||||||
{{ if $data.about.title }}
|
{{ if $data.top.secondaryTitle }}
|
||||||
{{$data.about.title}}
|
{{$data.top.secondaryTitle}}
|
||||||
{{else}}
|
{{else}}
|
||||||
You can put text in data/home/about.toml/title
|
You can put text in data/home/about.toml/title
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="text-lg mt-3">
|
<div class="text-lg mt-3">
|
||||||
{{ if $data.about.text}}
|
{{ if $data.top.text}}
|
||||||
{{ replace $data.about.text "\n" "<br />" | safeHTML }}
|
{{ replace $data.top.text "\n" "<br />" | safeHTML }}
|
||||||
{{else}}
|
{{else}}
|
||||||
You can put text in data/home/about.toml/text
|
You can put text in data/home/about.toml/text
|
||||||
{{end}}
|
{{end}}
|
Loading…
Reference in New Issue