summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorleafee98 <leafee98@hotmail.com>2022-05-18 13:50:07 +0800
committerleafee98 <leafee98@hotmail.com>2022-05-18 13:50:07 +0800
commit5b7390b5c2195b3deabbc867595574577d9d5076 (patch)
treec195fee5b0e96901e790df096340801fd26175a1
parentc078c22ea39529ff8908ede08c13b17da22da545 (diff)
add multi-section support
-rw-r--r--exampleSite/config.toml8
-rw-r--r--exampleSite/content/essays/What-Is-Hugo.md17
-rw-r--r--exampleSite/content/essays/_index.md10
-rw-r--r--exampleSite/content/posts/_index.md10
-rw-r--r--layouts/_default/baseof.html4
-rw-r--r--layouts/partials/side-recent.html6
6 files changed, 50 insertions, 5 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 3c22c7d..b9dfa0b 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -51,9 +51,15 @@ pre = "Theme <a href=\"https://cgit.leafee98.com/hugo-theme-flat.git\">hugo-them
[[menus.main]]
-name = "Archives"
+name = "Posts"
url = "/posts/"
weight = 30
+
+[[menus.main]]
+name = "Essays"
+url = "/essays/"
+weight = 40
+
[[menus.main]]
pageref = "about"
name = "About"
diff --git a/exampleSite/content/essays/What-Is-Hugo.md b/exampleSite/content/essays/What-Is-Hugo.md
new file mode 100644
index 0000000..b35ab86
--- /dev/null
+++ b/exampleSite/content/essays/What-Is-Hugo.md
@@ -0,0 +1,17 @@
+---
+title: "What Is Hugo"
+date: 2022-05-16T21:57:50+08:00
+tags: []
+categories: []
+draft: false
+---
+
+Hugo is a static site generator written in Go. Originally created by Steve Francia in 2013, Hugo has seen a great increase in both features and performance thanks to current lead developer Bjørn Erik Pedersen (since v0.14 in 2015[4]) and other contributors. Hugo is an open source project licensed under the Apache License 2.0.[5]
+
+<!--more-->
+
+Being able to generate most websites within seconds (at < 1 ms per page), Hugo's official website states it is "the world’s fastest framework for building websites". In July 2015, Netlify began providing Hugo hosting,[6] and in 2017, Smashing Magazine completed its redesign of their website, migrating from WordPress to a JAMstack solution with Hugo.[7]
+
+> Source: https://en.wikipedia.org/wiki/Hugo_(software)
+>
+> License: [CC-BY-SA 3.0](https://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License)
diff --git a/exampleSite/content/essays/_index.md b/exampleSite/content/essays/_index.md
new file mode 100644
index 0000000..dcded25
--- /dev/null
+++ b/exampleSite/content/essays/_index.md
@@ -0,0 +1,10 @@
+---
+title: "Essays"
+date: 2022-05-18T11:19:08+08:00
+tags: []
+categories: []
+weight: 70
+draft: false
+---
+
+<!--more-->
diff --git a/exampleSite/content/posts/_index.md b/exampleSite/content/posts/_index.md
new file mode 100644
index 0000000..bde4f09
--- /dev/null
+++ b/exampleSite/content/posts/_index.md
@@ -0,0 +1,10 @@
+---
+title: "Posts"
+date: 2022-05-18T11:22:44+08:00
+tags: []
+categories: []
+weight: 30
+draft: false
+---
+
+<!--more-->
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 9cda695..fc62752 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -12,7 +12,9 @@
{{ block "main" . }}{{ end }}
</div>
<div class="side">
- {{ partial "side-recent.html" . }}
+ {{ range .Site.Sections }}
+ {{ partial "side-recent.html" . }}
+ {{ end }}
{{ partial "side-categories.html" . }}
{{ partial "side-tags.html" . }}
</div>
diff --git a/layouts/partials/side-recent.html b/layouts/partials/side-recent.html
index 3e243f9..ce60d1c 100644
--- a/layouts/partials/side-recent.html
+++ b/layouts/partials/side-recent.html
@@ -1,12 +1,12 @@
<div class="side-recent">
- <h2 class="side-title">Recent Posts</h2>
+ <h2 class="side-title">Recent {{ .Section | humanize }}</h2>
<hr />
<ul>
- {{ range first 5 (where .Site.RegularPages ".Type" "in" .Site.Params.MainSections).ByDate.Reverse }}
+ {{ range first 5 .RegularPages.ByDate.Reverse }}
<li>
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
</li>
{{ end }}
</ul>
-</div> \ No newline at end of file
+</div>