From df1a0fd2ea998297348dffa9fc05a060dc2c437c Mon Sep 17 00:00:00 2001 From: f-dinucci Date: Tue, 31 May 2022 00:20:32 +0200 Subject: [PATCH] refactor[partials]: reorganize partials to enhance code reuse Partials have been reorganized, to improve general understandability and enhance code reuse (ex. when adding pages, the "wave" will be loaded as a partial) --- layouts/index.html | 2 +- layouts/partials/header.html | 2 +- layouts/partials/{ => home}/home.html | 61 ++++++++----------- .../{home_title.html => home/homeTitle.html} | 0 layouts/partials/{ => utilities}/navbar.html | 0 layouts/partials/utilities/wave.html | 16 +++++ 6 files changed, 45 insertions(+), 36 deletions(-) rename layouts/partials/{ => home}/home.html (69%) rename layouts/partials/{home_title.html => home/homeTitle.html} (100%) rename layouts/partials/{ => utilities}/navbar.html (100%) create mode 100644 layouts/partials/utilities/wave.html diff --git a/layouts/index.html b/layouts/index.html index ba6cda2..bf38815 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,3 +1,3 @@ {{ define "main" }} - {{ partial "home.html" . }} + {{ partial "home/home.html" . }} {{ end }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 6c00900..cbf6b8d 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1 +1 @@ -{{ partial "navbar.html" . }} +{{ partial "utilities/navbar.html" . }} diff --git a/layouts/partials/home.html b/layouts/partials/home/home.html similarity index 69% rename from layouts/partials/home.html rename to layouts/partials/home/home.html index d6858c2..b82688c 100644 --- a/layouts/partials/home.html +++ b/layouts/partials/home/home.html @@ -1,36 +1,29 @@
-
-
-
-
-
-
-
- {{if $.Site.Params.maintitle }}{{ $.Site.Params.maintitle }}{{else}}Hello, World{{end}} -
-
{{if $.Site.Params.maintext}}{{ $.Site.Params.maintext }}{{else}}Edit config.toml/params{{end}}
-
-
+ +
+ + {{ partial "utilities/wave"}} + +
+
+ {{if $.Site.Params.maintitle }}{{ $.Site.Params.maintitle }}{{else}}Hello, World{{end}} +
+ +
+ {{if $.Site.Params.maintext}}{{ $.Site.Params.maintext }}{{else}}Edit config.toml/params{{end}} +
+
+
+ + {{ $data := .Site.Data.home }}
- {{ partial "home_title" (dict "title" "About Me") }} + {{ partial "home/homeTitle" (dict "title" "About Me") }}
{{ range $data.about.link }} {{end}} @@ -52,9 +45,9 @@
- {{ partial "home_title" (dict "title" "Skills") }} + {{ partial "home/homeTitle" (dict "title" "Skills") }}
- + {{if $data.skills.list}}
- {{ partial "home_title" (dict "title" "Projects") }} + {{ partial "home/homeTitle" (dict "title" "Projects") }}
- + {{if $data.skills.list}}
- + /> +
{{ .title }}

diff --git a/layouts/partials/home_title.html b/layouts/partials/home/homeTitle.html similarity index 100% rename from layouts/partials/home_title.html rename to layouts/partials/home/homeTitle.html diff --git a/layouts/partials/navbar.html b/layouts/partials/utilities/navbar.html similarity index 100% rename from layouts/partials/navbar.html rename to layouts/partials/utilities/navbar.html diff --git a/layouts/partials/utilities/wave.html b/layouts/partials/utilities/wave.html new file mode 100644 index 0000000..c603722 --- /dev/null +++ b/layouts/partials/utilities/wave.html @@ -0,0 +1,16 @@ +

+
+
+