From fa98ab0589d4be1ca89a0538f6826b0037ff9821 Mon Sep 17 00:00:00 2001 From: Ngô Ngọc Đức Huy Date: Thu, 27 Jul 2023 14:04:30 +0700 Subject: Set up layout and navigation --- .gitmodules | 3 +++ assets/css | 1 + layouts/_default/baseof.html | 22 ++++++++++------------ layouts/_default/list.html | 11 ++++------- layouts/_default/single.html | 17 +++++++---------- layouts/index.html | 10 ++++++++++ layouts/partials/footer.html | 8 +++----- layouts/partials/head.html | 10 ++++++++++ layouts/partials/header.html | 3 +++ layouts/partials/post-info.html | 0 layouts/partials/post-language-switcher.html | 16 ++++++++++++++++ layouts/partials/post-navigation.html | 9 +++++++++ layouts/partials/single-extra.html | 0 13 files changed, 76 insertions(+), 34 deletions(-) create mode 100644 .gitmodules create mode 160000 assets/css create mode 100644 layouts/partials/post-info.html create mode 100644 layouts/partials/post-language-switcher.html create mode 100644 layouts/partials/post-navigation.html create mode 100644 layouts/partials/single-extra.html diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..c62dd8b --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "assets/css"] + path = assets/css + url = https://codeberg.org/Freedom-to-Write/readable.css diff --git a/assets/css b/assets/css new file mode 160000 index 0000000..713594e --- /dev/null +++ b/assets/css @@ -0,0 +1 @@ +Subproject commit 713594e2e7b434d5d6cdbc011a68fb4e44cd60e6 diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index d7bff57..b17f8ce 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -13,18 +13,16 @@ SPDX-License-Identifier: MIT {{ i18n "skipToContent" | humanize }} -
-
- {{ block "header" . }} - {{ partial "header.html" . }} - {{ end }} -
-
- {{ block "main" . }}{{ end }} -
- {{ block "footer" . }} - {{ partial "footer.html" . }} +
+ {{ block "header" . }} + {{ partial "header.html" . }} {{ end }} -
+ +
+ {{ block "main" . }}{{ end }} +
+ {{ block "footer" . }} + {{ partial "footer.html" . }} + {{ end }} diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 8a60cb4..dfd346c 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -10,17 +10,14 @@ SPDX-License-Identifier: MIT

{{ i18n .Title }}

- {{ $pages := where .Pages "Type" "in" site.Params.mainSections }}
    - {{ range $pages }} -
  1. -

    - {{ trim .Title " " }} -

    + {{ range sort .Pages "Weight" }} +
  2. + {{ trim .Title " " }} {{ partial "post-language-switcher.html" . }} {{ partial "post-info.html" . }}
  3. {{ end }} -
  4. +
{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index bd91a76..5d37444 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -5,21 +5,18 @@ SPDX-License-Identifier: MIT */}} {{ define "main" }} -
-
-

{{ trim .Title " " }}

+
+
+

{{ trim .Title " " }}

{{ partial "post-language-switcher.html" . }} + {{ partial "post-navigation.html" . }}
-
- {{ .Content }} -
- {{ partial "post-info.html" . }} + {{ .Content }}
+ {{ partial "single-extra.html" }} - {{ if and (.Site.Params.paginationSinglePost) (ne .Type "page") }} - {{ partial "post-pagination.html" . }} - {{ end }} + {{ partial "post-navigation.html" . }} {{ end }} diff --git a/layouts/index.html b/layouts/index.html index e69de29..07fbc94 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -0,0 +1,10 @@ +{{ define "main" }} +
+ {{ .Content }} + +
+{{ end }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 8707172..619beab 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -6,19 +6,17 @@ SPDX-License-Identifier: MIT
{{ $languagesCount := $.Site.Home.AllTranslations }} - {{ if gt $languagesCount 1 }} + {{/* if gt $languagesCount 1 }} {{ partial "language-switcher.html" . }} - {{ end }} + {{ end */}} - - {{ partial "h-card.html" . }}
diff --git a/layouts/partials/head.html b/layouts/partials/head.html index e69de29..86c4a33 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -0,0 +1,10 @@ +{{ $style := resources.Get "css/readable.css" }} + + + + + + +{{ if and (.Title) (not .IsHome) }}{{ .Title }} - {{ end }}{{ .Site.Title }} + + diff --git a/layouts/partials/header.html b/layouts/partials/header.html index e69de29..d015389 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -0,0 +1,3 @@ + diff --git a/layouts/partials/post-info.html b/layouts/partials/post-info.html new file mode 100644 index 0000000..e69de29 diff --git a/layouts/partials/post-language-switcher.html b/layouts/partials/post-language-switcher.html new file mode 100644 index 0000000..162cdf3 --- /dev/null +++ b/layouts/partials/post-language-switcher.html @@ -0,0 +1,16 @@ +{{ if .IsTranslated }} + {{ $pageLang := .Page.Lang}} +
    + {{ range .AllTranslations }} + {{ if eq .Lang $pageLang }} +
  • + {{ upper .Lang }} +
  • + {{ else }} +
  • + {{ upper .Lang }} +
  • + {{ end }} + {{ end }} +
+{{ end }} \ No newline at end of file diff --git a/layouts/partials/post-navigation.html b/layouts/partials/post-navigation.html new file mode 100644 index 0000000..b88d91f --- /dev/null +++ b/layouts/partials/post-navigation.html @@ -0,0 +1,9 @@ + diff --git a/layouts/partials/single-extra.html b/layouts/partials/single-extra.html new file mode 100644 index 0000000..e69de29 -- cgit 1.4.1