- 配置定义菜单栏,拷贝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 }}&copy; {{ 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