- 配置定義菜單欄,拷貝base目錄,改名為hugo-menu,以hyde模板為例,hyde默認有邊欄,菜單顯示在邊欄里面,代碼如下
1. themes/layouts/partials/sidebar.html
```
<aside class="sidebar">
<div class="container sidebar-sticky">
<div class="sidebar-about">
<a href="{{ .Site.BaseURL }}"><h1>{{ .Site.Title }}</h1></a>
<p class="lead">
{{ with .Site.Params.description }} {{.}} {{ else }}An elegant open source and mobile first theme Originally made for Jekyll.{{end}}
</p>
</div>
<nav>
<ul class="sidebar-nav">
<li><a href="{{ .Site.BaseURL }}">主頁</a> </li>
{{ range .Site.Menus.main -}}
<li><a href="{{.URL}}"> {{ .Name }} </a></li>
{{- end }}
</ul>
</nav>
<p>{{ with .Site.Params.copyright }}{{.}}{{ else }}© {{ now.Format "2006"}}. All rights reserved. {{end}}</p>
</div>
</aside>
```
2. hugo-menu/config.toml
```
baseURL = "http://yunduan.github.io/"
languageCode = "en-us"
title = "yunduan"
theme = "hyde"
[params]
description = "云端的個人網站,hugo網站制作,aws云計算,Linux相關"
[menu]
[[menu.main]]
identifier = "blog"
name = "博客"
url = "/posts/"
weight = 2
[[menu.main]]
identifier = "tags"
name = "標簽"
url = "/tags/"
weight = 3
[[menu.main]]
identifier = "about"
name = "關于我"
url = "/about"
weight = 4
[[menu.main]]
identifier = "rss"
name = "RSS"
url = "/index.xml"
weight = 5s
```
- 博客菜單下面創建文章
1. content/posts 目錄下面手動添加文章abc.md ,或者
2. hugo-menu 目錄下執行..\bin\hugo new posts/abc.md 查看 content/posts 目錄下的abc.md
3. hugo-menu 目錄下執行..\bin\hugo -D ,查看public/posts/abc.html
- 【入門】1:Hugo介紹
- 【入門】2:Hugo網站和主題演示
- 【入門】3:Hugo跟Wordpress和Hexo對比
- 【入門】4:20分鐘快速搭建Hugo網站
- 【入門】5:免費網站托管到Gitpages
- 【入門】6:圖標icon/robot.txt/404頁面創建和設置
- 【入門】7:網站地圖sitemap
- 【進階】8:自定義菜單
- 【進階】9:自定義Tag/category
- 【進階】10:頁面Meta keyword
- 【進階】12:創建頁面摘要
- 【進階】11:創建列表【進行中...】
- 【進階】13:創建分頁
- 【進階】14:創建統計
- 【進階】15:創建rss
- 【高級】16:創建頁面目錄
- 【高級】17:創建站內搜索
- 【高級】18:創建多語言支持
- 【高級】19:顯示相關內容
- 【高級】20:顯示當前頁面所有Tag
- 【高級】21:創建社交聯系方式
- 【高級】22:創建社交分享
- 【高級】23:創建評論gitalk
- 【高級】24:自動化部署-netlify
- 【高級】25:自動化部署-Github actions