about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNgô Ngọc Đức Huy <huyngo@disroot.org>2023-07-27 14:04:30 +0700
committerNgô Ngọc Đức Huy <huyngo@disroot.org>2023-07-27 14:04:30 +0700
commitfa98ab0589d4be1ca89a0538f6826b0037ff9821 (patch)
tree7c019babc4d02a3b7bc8dfb2fb6550fdc58345c7
parent890252ec5e659b439165e0d18ca991ef1bfad9ee (diff)
downloadvictor-fa98ab0589d4be1ca89a0538f6826b0037ff9821.tar.gz
Set up layout and navigation
-rw-r--r--.gitmodules3
m---------assets/css0
-rw-r--r--layouts/_default/baseof.html22
-rw-r--r--layouts/_default/list.html11
-rw-r--r--layouts/_default/single.html17
-rw-r--r--layouts/index.html10
-rw-r--r--layouts/partials/footer.html8
-rw-r--r--layouts/partials/head.html10
-rw-r--r--layouts/partials/header.html3
-rw-r--r--layouts/partials/post-info.html0
-rw-r--r--layouts/partials/post-language-switcher.html16
-rw-r--r--layouts/partials/post-navigation.html9
-rw-r--r--layouts/partials/single-extra.html0
13 files changed, 75 insertions, 34 deletions
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
+Subproject 713594e2e7b434d5d6cdbc011a68fb4e44cd60e
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
 </head>
 <body>
     <a class="skip-main" href="#main">{{ i18n "skipToContent" | humanize }}</a>
-    <div class="container">
-        <header class="common-header"> 
-            {{ block "header" . }}
-                {{ partial "header.html" . }}
-            {{ end }}
-        </header>
-        <main id="main" tabindex="-1"> 
-            {{ block "main" . }}{{ end }}
-        </main>
-        {{ block "footer" . }}
-            {{ partial "footer.html" . }}
+    <header> 
+        {{ block "header" . }}
+        {{ partial "header.html" . }}
         {{ end }}
-    </div>
+    </header>
+    <main tabindex="-1"> 
+        {{ block "main" . }}{{ end }}
+    </main>
+    {{ block "footer" . }}
+    {{ partial "footer.html" . }}
+    {{ end }}
 </body>
 </html>
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
   </section>
   <section class="toc">
     <h1 class="post-title">{{ i18n .Title }}</h1>
-    {{ $pages := where .Pages "Type" "in" site.Params.mainSections }}
     <ol>
-      {{ range $pages }}
-        <li class="post-short-list h-entry">
-          <h2 class="p-name post-title{{ if .Params.draft }} draft{{end}}">
-            <a class="u-url" href="{{ .RelPermalink }}">{{ trim .Title " " }}</a>
-          </h2>
+      {{ range sort .Pages "Weight" }}
+        <li>
+          <a href="{{ .RelPermalink }}">{{ trim .Title " " }}</a>
           {{ partial "post-language-switcher.html" . }}
           {{ partial "post-info.html" . }}
         </li>
       {{ end }}
-      <li>
+      <ol>
   </section>
 {{ 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" }}
-  <article class="post h-entry">
-    <header class="post-header">
-      <h1 class="p-name post-title{{ if .Params.draft }} draft{{end}}">{{ trim .Title  " " }}</h1>
+  <article>
+    <header>
+      <h1>{{ trim .Title  " " }}</h1>
       {{ partial "post-language-switcher.html" . }}
+      {{ partial "post-navigation.html" . }}
     </header>
-    <div class="content e-content">
-      {{ .Content }}
-    </div>
-    {{ partial "post-info.html" . }}
+    {{ .Content }}
   </article>
 
+
   {{ 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" }}
+<main>
+	{{ .Content }}
+	<ul>
+		{{ range .Pages }}
+		<li><a href="{{ .Permalink }}">{{ .Title }}</a></li>
+		{{ end }}
+	</ul>
+</main>
+{{ 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
 
 <footer class="common-footer" id="footer">
   {{ $languagesCount := $.Site.Home.AllTranslations }}
-  {{ if gt $languagesCount 1 }}
+  {{/* if gt $languagesCount 1 }}
     {{ partial "language-switcher.html" . }}
-  {{ end }}
+  {{ end */}}
 
   <div class="common-footer-bottom">
     <div class="copyright">
-      <p>© {{ if isset .Site.Params "author"}}{{ .Site.Params.author }}, {{end}}{{ now.Year }}</p>
+      {{ if isset .Site.Params "author"}}<p>© {{ .Site.Params.author }}, {{ now.Year }}</p>{{end}}
       <p>{{ partial "copyright.html" . }}</p>
     </div> 
     <div>
       {{ partial "footer-extra.html" . }}
     </div>
   </div>
-
-  {{ partial "h-card.html" . }}
 </footer>
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" }}
+
+<meta charset="utf-8">
+<meta name="HandheldFriendly" content="True">
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<meta name="referrer" content="no-referrer-when-downgrade">
+
+<title>{{ if and (.Title) (not .IsHome) }}{{ .Title }} - {{ end }}{{ .Site.Title }}</title>
+<meta name="description" content="{{ .Site.Params.Description }}">
+<link rel="stylesheet" type="text/css" href="{{ $style.RelPermalink }}">
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 @@
+<nav>
+	<a href="/" >{{ .Site.Title }}</a>
+</nav>
diff --git a/layouts/partials/post-info.html b/layouts/partials/post-info.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/layouts/partials/post-info.html
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}}
+    <ul class="post-translations">
+        {{ range .AllTranslations }}
+            {{ if eq .Lang $pageLang }}
+                <li>
+                    {{ upper .Lang }}
+                </li>
+            {{ else }}
+                <li>
+                    <a href="{{ .Permalink }}">{{ upper .Lang }}</a>
+                </li>
+            {{ end }}
+        {{ end }}
+    </ul>
+{{ 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 @@
+<nav>
+	{{ if .NextInSection }}
+	<a class="nav-next" href="{{ .NextInSection.RelPermalink }}">{{ .NextInSection.Title }}</a>
+	{{ end }}
+	<a class="nav-up" href="{{ .Parent.RelPermalink }}">{{ .Parent.Title }}</a>
+	{{ if .PrevInSection }}
+	<a  class="nav-prev"href="{{ .PrevInSection.RelPermalink }}">{{ .PrevInSection.Title }}</a>
+	{{ end }}
+</nav>
diff --git a/layouts/partials/single-extra.html b/layouts/partials/single-extra.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/layouts/partials/single-extra.html