feat: improve configuration (#245)

* feat: improve configuration

* fix: fix partials/footer.html error
This commit is contained in:
Dillon
2020-04-21 22:55:06 +08:00
committed by GitHub
parent 8a0e61085c
commit f14301c395
62 changed files with 1548 additions and 1669 deletions

View File

@@ -1,38 +1,21 @@
---
weight: 1
title: "主题文档 - 基本概念"
subtitle: ""
date: 2020-03-06T21:40:32+08:00
lastmod: 2020-03-06T21:40:32+08:00
draft: false
author: "Dillon"
authorLink: "https://dillonzq.com"
description: "探索 Hugo - LoveIt 主题的全部内容和背后的核心概念."
license: ""
tags: ["安装", "配置"]
categories: ["documentation"]
hiddenFromHomePage: false
featuredImage: "/images/theme-documentation-basics/featured-image.jpg"
featuredImagePreview: ""
toc: true
autoCollapseToc: false
math: false
mapbox:
accessToken: ""
lightStyle: ""
darkStyle: ""
navigation: true
geolocate: true
scale: true
fullscreen: true
toc:
auto: false
lightgallery: true
linkToMarkdown: true
share:
enable: true
comment: true
---
探索 Hugo - **LoveIt** 主题的全部内容和背后的核心概念.
@@ -105,7 +88,7 @@ theme = "LoveIt"
[params]
# LoveIt 主题版本
version = "0.1.X"
version = "0.2.X"
[menu]
[[menu.main]]
@@ -148,7 +131,7 @@ hugo new posts/first_post.md
通过添加一些示例内容并替换文件开头的标题, 你可以随意编辑文章.
{{< admonition >}}
默认情况下, 所有文章和页面均作为草稿创建. 如果想要渲染这些页面, 请从元数据中删除属性 `draft: true`, 或者设置属性 `draft: false`.
默认情况下, 所有文章和页面均作为草稿创建. 如果想要渲染这些页面, 请从元数据中删除属性 `draft: true`, 设置属性 `draft: false` 或者为 `hugo` 命令添加 `-D`/`--buildDrafts` 参数.
{{< /admonition >}}
### 2.5 在本地启动网站
@@ -167,6 +150,15 @@ hugo serve
当你运行 `hugo serve` 时, 当文件内容更改时, 页面会随着更改自动刷新.
{{< /admonition >}}
{{< admonition >}}
由于本主题使用了 Hugo 中的 `.Scratch` 来实现一些特性,
非常建议你为 `hugo server` 命令添加 `--disableFastRender` 参数来实时预览你正在编辑的文章页面.
```bash
hugo serve --disableFastRender
```
{{< /admonition >}}
### 2.6 构建网站
当你准备好部署你的网站时, 运行以下命令:
@@ -194,8 +186,8 @@ hugo
```toml
[params]
# LoveIt 主题版本
version = "0.1.X"
# {{< version 0.2.0 changed >}} LoveIt 主题版本
version = "0.2.X"
# 网站描述
description = "这是我的全新 Hugo 网站"
# 网站关键词
@@ -207,34 +199,65 @@ hugo
# {{< version 0.1.1 >}} 哪种哈希函数用来 SRI, 为空时表示不使用 SRI
# ("sha256", "sha384", "sha512", "md5")
fingerprint = ""
# {{< version 0.2.0 >}} 搜索
# {{< version 0.2.0 >}} 日期格式
dateFormat = "2006-01-02"
# {{< version 0.2.0 >}} 搜索配置
[params.search]
enable = true
# 搜索引擎的类型 ("lunr", "algolia")
type = "lunr"
# 文章内容索引长度
contentLength = 5000
# 搜索框的占位提示语
placeholder = ""
[params.search.algolia]
index = ""
appID = ""
searchKey = ""
# 页面头部导航栏信息
# 页面头部导航栏配置
[params.header]
# 桌面端导航栏模式 ("fixed", "normal", "auto")
desktopMode = "fixed"
# 移动端导航栏模式 ("fixed", "normal", "auto")
mobileMode = "auto"
# 页面底部版权信息设置
# 页面底部信息配置
[params.footer]
enable = true
# {{< version 0.2.0 >}} 自定义内容 (支持 HTML 格式)
custom = ''
# {{< version 0.2.0 >}} 是否显示 Hugo 和主题信息
hugo = true
# {{< version 0.2.0 >}} 是否显示版权信息
copyright = true
# {{< version 0.2.0 >}} 是否显示作者
author = true
# 网站创立年份
since = 2019
# ICP 备案信息,仅在中国使用 (支持 HTML 格式)
icp = ""
# 许可协议信息 (支持 HTML 格式)
license = '<a rel="license external nofollow noopener noreffer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a>'
# 文章页面配置
# {{< version 0.2.0 >}} Section (所有文章) 页面配置
[params.section]
# section 页面每页显示文章数量
paginate = 20
# 日期格式 (月和日)
dateFormat = "01-02"
# {{< version 0.2.0 >}} List (目录或标签) 页面配置
[params.list]
# list 页面每页显示文章数量
paginate = 20
# 日期格式 (月和日)
dateFormat = "01-02"
# 主页配置
[params.home]
# 主页信息设置
# 主页个人信息
[params.home.profile]
enable = true
# Gravatar 邮箱,用于优先在主页显示的头像
@@ -254,9 +277,10 @@ hugo
enable = true
# 主页每页显示文章数量
paginate = 6
# 当你没有在文章前置参数中设置 "hiddenFromHomePage" 时的默认行为
# {{< version 0.2.0 deleted >}} 当你没有在文章前置参数中设置 "hiddenFromHomePage" 时的默认行为
defaultHiddenFromHomePage = false
# 主页的社交信息设置
# 作者的社交信息设置
[params.social]
GitHub = "xxxx"
# Linkedin = "xxxx"
@@ -322,119 +346,157 @@ hugo
# XMPP = "xxxx"
# Matrix = "xxxx"
Bilibili = "xxxx"
# 文章页面配置
# {{< version 0.2.0 changed >}} 文章页面配置
[params.page]
# {{< version 0.2.0 >}} 是否在主页隐藏一篇文章
hiddenFromHomePage = false
# {{< version 0.2.0 >}} 是否在搜索结果中隐藏一篇文章
hiddenFromSearch = false
# 是否在文章页面使用 lightgallery
lightgallery = true
# {{< version 0.2.0 >}} 是否显示代码块的复制按钮
copyCode = true
# {{< version 0.2.0 >}} 是否使用 ruby 扩展语法
ruby = true
# {{< version 0.2.0 >}} 是否使用 fraction 扩展语法
fraction = true
# {{< version 0.2.0 >}} 是否使用 fontawesome 扩展语法
fontawesome = true
# 是否在文章页面显示原始 Markdown 文档链接
linkToMarkdown = true
# {{< link "https://katex.org/" KaTeX >}} 数学公式
[params.math]
enable = true
# 默认块定界符是 $$ ... $$ 和 \\[ ... \\]
blockLeftDelimiter = ""
blockRightDelimiter = ""
# 默认内联定界符是 $ ... $ 和 \\( ... \\)
inlineLeftDelimiter = ""
inlineRightDelimiter = ""
# KaTeX 插件 copy_tex
copyTex = true
# KaTeX 插件 mhchem
mhchem = true
# {{< version 0.2.0 >}} {{< link "https://docs.mapbox.com/mapbox-gl-js" "Mapbox GL JS" >}} 配置
[params.mapbox]
# Mapbox GL JS 的 access token
accessToken = ""
# 浅色主题的地图样式
lightStyle = "mapbox://styles/mapbox/light-v9"
# 深色主题的地图样式
darkStyle = "mapbox://styles/mapbox/dark-v9"
# 是否添加 {{< link "https://docs.mapbox.com/mapbox-gl-js/api/#navigationcontrol" NavigationControl >}}
navigation = true
# 是否添加 {{< link "https://docs.mapbox.com/mapbox-gl-js/api/#geolocatecontrol" GeolocateControl >}}
geolocate = true
# 是否添加 {{< link "https://docs.mapbox.com/mapbox-gl-js/api/#scalecontrol" ScaleControl >}}
scale = true
# 是否添加 {{< link "https://docs.mapbox.com/mapbox-gl-js/api/#fullscreencontrol" FullscreenControl >}}
fullscreen = true
# 文章页面的分享信息设置
[params.share]
enable = true
Twitter = true
Facebook = true
# Linkedin = true
# Whatsapp = true
# Pinterest = true
# Tumblr = true
# HackerNews = true
# Reddit = true
# VK = true
# Buffer = true
# Xing = true
# Line = true
# Instapaper = true
# Pocket = true
# Digg = true
# Stumbleupon = true
# Flipboard = true
Weibo = true
# Renren = true
# Myspace = true
# Blogger = true
# Baidu = true
# Odnoklassniki = true
Evernote = true
# Skype = true
# Trello = true
# Mix = true
# 评论系统设置
[params.comment]
enable = true
# {{< link "https://disqus.com/" Disqus >}} 评论系统设置
[params.comment.disqus]
# {{< version 0.1.1 >}}
enable = false
# Disqus 的 shortname用来在文章中启用 Disqus 评论系统
shortname = ""
# {{< link "https://github.com/gitalk/gitalk" Gitalk >}} 评论系统设置
[params.comment.gitalk]
# {{< version 0.1.1 >}}
enable = false
owner = ""
repo = ""
clientId = ""
clientSecret = ""
# {{< link "https://github.com/xCss/Valine" Valine >}} 评论系统设置
[params.comment.valine]
enable = false
appId = ""
appKey = ""
placeholder = "Your comment ..."
notify = false
verify = true
avatar = "mp"
meta= ""
pageSize = 10
lang = "en"
visitor = true
recordIP = true
# # {{< link "https://developers.facebook.com/docs/plugins/comments" "Facebook 评论系统" >}}设置
[params.comment.facebook]
enable = false
width = "100%"
numPosts = 10
appId = ""
languageCode = "zh_CN"
# {{< version 0.2.0 >}} {{< link "https://comments.app/" "Telegram Comments" >}} 评论系统设置
[params.comment.telegram]
enable = false
siteID = ""
limit = 5
height = ""
color = ""
colorful = true
dislikes = false
outlined = false
# {{< version 0.2.0 >}} 目录配置
[params.page.toc]
# 是否使用目录
enable = true
# 是否使目录自动折叠展开
auto = true
# {{< version 0.2.0 changed >}} {{< link "https://katex.org/" KaTeX >}} 数学公式
[params.page.math]
enable = true
# 默认块定界符是 $$ ... $$ 和 \\[ ... \\]
blockLeftDelimiter = ""
blockRightDelimiter = ""
# 默认内联定界符是 $ ... $ 和 \\( ... \\)
inlineLeftDelimiter = ""
inlineRightDelimiter = ""
# KaTeX 插件 copy_tex
copyTex = true
# KaTeX 插件 mhchem
mhchem = true
# {{< version 0.2.0 >}} {{< link "https://docs.mapbox.com/mapbox-gl-js" "Mapbox GL JS" >}} 配置
[params.page.mapbox]
# Mapbox GL JS 的 access token
accessToken = ""
# 浅色主题的地图样式
lightStyle = "mapbox://styles/mapbox/light-v9"
# 深色主题的地图样式
darkStyle = "mapbox://styles/mapbox/dark-v9"
# 是否添加 {{< link "https://docs.mapbox.com/mapbox-gl-js/api/#navigationcontrol" NavigationControl >}}
navigation = true
# 是否添加 {{< link "https://docs.mapbox.com/mapbox-gl-js/api/#geolocatecontrol" GeolocateControl >}}
geolocate = true
# 是否添加 {{< link "https://docs.mapbox.com/mapbox-gl-js/api/#scalecontrol" ScaleControl >}}
scale = true
# 是否添加 {{< link "https://docs.mapbox.com/mapbox-gl-js/api/#fullscreencontrol" FullscreenControl >}}
fullscreen = true
# {{< version 0.2.0 changed >}} 文章页面的分享信息设置
[params.page.share]
enable = true
Twitter = true
Facebook = true
# Linkedin = true
# Whatsapp = true
# Pinterest = true
# Tumblr = true
# HackerNews = true
# Reddit = true
# VK = true
# Buffer = true
# Xing = true
# Line = true
# Instapaper = true
# Pocket = true
# Digg = true
# Stumbleupon = true
# Flipboard = true
Weibo = true
# Renren = true
# Myspace = true
# Blogger = true
# Baidu = true
# Odnoklassniki = true
Evernote = true
# Skype = true
# Trello = true
# Mix = true
# {{< version 0.2.0 changed >}} 评论系统设置
[params.page.comment]
enable = true
# {{< link "https://disqus.com/" Disqus >}} 评论系统设置
[params.page.comment.disqus]
# {{< version 0.1.1 >}}
enable = false
# Disqus 的 shortname用来在文章中启用 Disqus 评论系统
shortname = ""
# {{< link "https://github.com/gitalk/gitalk" Gitalk >}} 评论系统设置
[params.page.comment.gitalk]
# {{< version 0.1.1 >}}
enable = false
owner = ""
repo = ""
clientId = ""
clientSecret = ""
# {{< link "https://github.com/xCss/Valine" Valine >}} 评论系统设置
[params.page.comment.valine]
enable = false
appId = ""
appKey = ""
placeholder = "Your comment ..."
notify = false
verify = true
avatar = "mp"
meta= ""
pageSize = 10
lang = "en"
visitor = true
recordIP = true
# {{< link "https://developers.facebook.com/docs/plugins/comments" "Facebook 评论系统" >}}设置
[params.page.comment.facebook]
enable = false
width = "100%"
numPosts = 10
appId = ""
languageCode = "zh_CN"
# {{< version 0.2.0 >}} {{< link "https://comments.app/" "Telegram Comments" >}} 评论系统设置
[params.page.comment.telegram]
enable = false
siteID = ""
limit = 5
height = ""
color = ""
colorful = true
dislikes = false
outlined = false
# {{< version 0.2.0 >}} SEO config
[params.page.seo]
# 出版者信息
[params.page.seo.publisher]
name = "xxxx"
[params.page.seo.publisher.logo]
url = "logo.png"
width = 127
height = 40
# Logo 信息
[params.page.seo.logo]
url = "logo.png"
width = 127
height = 40
# 图片信息
[params.page.seo.image]
url = "cover.png"
width = 800
height = 600
# 网站验证代码,用于 Google/Bing/Yandex/Pinterest/Baidu
[params.verification]
@@ -443,23 +505,7 @@ hugo
yandex = ""
pinterest = ""
baidu = ""
# 出版者信息,仅用于 SEO
[params.publisher]
name = "xxxx"
[params.publisher.logo]
url = "logo.png"
width = 127
height = 40
# 网站 Logo 信息,仅用于 SEO
[params.logo]
url = "logo.png"
width = 127
height = 40
# 网站图标信息,仅用于 SEO
[params.image]
url = "cover.png"
width = 800
height = 600
# CSS 和 JS 文件的 CDN 设置
[params.cdn]
# {{< version 0.2.0 >}} {{< link "https://github.com/necolas/normalize.css" "normalize.css" >}}@8.0.1
@@ -544,27 +590,26 @@ hugo
startLevel = 2
endLevel = 6
# 作者信息
# 作者配置
[author]
name = "xxxx"
link = ""
# 网站地图信息
# 网站地图配置
[sitemap]
changefreq = "weekly"
filename = "sitemap.xml"
priority = 0.5
# {{< link "https://gohugo.io/content-management/urls/#permalinks" "Permalinks 信息" >}}
# {{< link "https://gohugo.io/content-management/urls/#permalinks" "Permalinks 配置" >}}
[Permalinks]
# posts = ":year/:month/:filename"
posts = ":filename"
# {{< link "https://gohugo.io/about/hugo-and-gdpr/" "隐私信息置" >}}
# {{< link "https://gohugo.io/about/hugo-and-gdpr/" "隐私信息置" >}}
[privacy]
[privacy.googleAnalytics]
anonymizeIP = true
[privacy.youtube]
privacyEnhanced = true