包含标签 themes 的文章

手把手使用Hugo搭建网站-高级篇

1.3. 手把手使用hugo搭建网站高级篇 1.3.1. 創建页面的目錄 hugo提供了目錄的支持table of content 創建目錄首先你的文章必須有標題 在layouts/_default/single.html 添加代碼 {{.TableOfContents}} {{ define "main" -}} <div class="post"> <h1>{{ .Title }}</h1> <time datetime={{ .Date.Format "2006-01-02T15:04:05Z0700" }} class="post-date">{{ .Date.Format "Mon, Jan 2, 2006" }}</time> {{.TableOfContents}} {{ .Content }} </div> {{ if .Site.DisqusShortname -}} <h2>Comments</h2> {{ template "_internal/disqus.html" . }} {{- end }} {{ partial "related.html" . }} {{- end }} 1.3.2. 创建搜索 伪站内搜索 使用google cse……

阅读全文

手把手使用Hugo搭建网站-中级篇

1.2. 手把手使用hugo搭建网站进阶篇 1.2.1. 自定义菜单 配置定义菜单栏 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 }}{{end}} </p> </div> <nav> <ul class="sidebar-nav"> {{ $currentPage := . }} {{ range .Site.Menus.main -}} <li> <a class="sidebar-nav-item{{if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} active{{end}}" href="{{ .URL }}" title="{{ .Title }}">{{ .Name }}</a> </li> {{- end }} </ul> <ul class="sidebar-nav"><br/><br/><br/><br/><br/><br/><br/></ul> </nav> <p>{{ with .……

阅读全文

手把手使用Hugo搭建网站-初级篇

1.1. 手把手使用hugo搭建网站初级篇 1.1.1. Demo使用hugo的网站 https://www.flysnow.org/ https://www.gohugo.io https://www.netlify.com/ https://gohugo.io/showcase/ https://www.smashingmagazine.com/ 1.1.2. 部分主题 https://github.com/Vimux/Mainroad https://github.com/kingfsen/Mainroad https://themes.gohugo.io/academic/ https://themes.gohugo.io/beautifulhugo/ https://themes.gohugo.io/hyde/ https://themes.gohugo.io/hugo-theme-even/ https://github.com/rujews/maupassant-hugo 1.1.3. hugo跟wordpress其他建站工具的对比 wordpress 全球31%的网站使用wordpress,尽管他有各种主题和插件,但是也有非常多的缺点,安全性,seo不够友好,定制麻烦 hugo 最快的静态生成工具,seo友好,静态更安全,方便定制模板,缺点没有插件,如果要定制模板只能懂一点go的语法 wordpress是动态的并且还需要托管数据库,所以托管费用比较昂贵 hugo是生成静态的页面,在本地生成后上传到服务器就可以了,托管费用非常便宜,可以直接用免费的github托管 hugo不可以在线编辑 wordpress vs hugo Tables 静态/动态 托管 安全性 访问速度 在线编辑 markdown wordpress 动态 复杂 需要经常升级 快 可以 不支持 hugo 静态 简单 不需要打补丁 非常快 不可以 支持……

阅读全文