add multi-section support

This commit is contained in:
leafee98 2022-05-18 13:50:07 +08:00
parent c078c22ea3
commit 5b7390b5c2
6 changed files with 50 additions and 5 deletions

View file

@ -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"

View file

@ -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 worlds 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)

View file

@ -0,0 +1,10 @@
---
title: "Essays"
date: 2022-05-18T11:19:08+08:00
tags: []
categories: []
weight: 70
draft: false
---
<!--more-->

View file

@ -0,0 +1,10 @@
---
title: "Posts"
date: 2022-05-18T11:22:44+08:00
tags: []
categories: []
weight: 30
draft: false
---
<!--more-->

View file

@ -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>

View file

@ -1,9 +1,9 @@
<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>