From 5b7390b5c2195b3deabbc867595574577d9d5076 Mon Sep 17 00:00:00 2001 From: leafee98 Date: Wed, 18 May 2022 13:50:07 +0800 Subject: [PATCH] add multi-section support --- exampleSite/config.toml | 8 +++++++- exampleSite/content/essays/What-Is-Hugo.md | 17 +++++++++++++++++ exampleSite/content/essays/_index.md | 10 ++++++++++ exampleSite/content/posts/_index.md | 10 ++++++++++ layouts/_default/baseof.html | 4 +++- layouts/partials/side-recent.html | 6 +++--- 6 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 exampleSite/content/essays/What-Is-Hugo.md create mode 100644 exampleSite/content/essays/_index.md create mode 100644 exampleSite/content/posts/_index.md 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 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] + + + +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 +--- + + 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 +--- + + 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 }}
- {{ partial "side-recent.html" . }} + {{ range .Site.Sections }} + {{ partial "side-recent.html" . }} + {{ end }} {{ partial "side-categories.html" . }} {{ partial "side-tags.html" . }}
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 @@
-

Recent Posts

+

Recent {{ .Section | humanize }}


-
\ No newline at end of file +