3
从零开始搭建个人博客(三)- hugo高级配置,让博客更亮眼
source link: https://www.leftpocket.cn/post/hugo/hugo_advanced/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
原文地址:码农在新加坡的个人博客
使用个人博客也有一年多的时间,这一年多的时候踩了很多坑,也学到了很多知识。
这里分享一个系列教程:从零开始搭建个人博客,把我的经验分享在这里。
系列地址:https://left-pocket.github.io
从零开始搭建个人博客(三)- hugo高级配置,让你的博客更亮眼
当前我们已经把个人博客托管到了Github Pages里面了,也能使用浏览器访问我们的个人博客了。
我们需要修改一些主题配置,让我们的博客看起来更完善。
URL和语言
baseURL = "https://left-pocket.github.io" // 你的博客主页
languageCode = "zh-cn" // 语言
defaultContentLanguage = "zh-cn"
每页展示数量
根据自己想要展示的数量修改
paginate = 10 # 首页每页显示的文章数
toc = true # 是否开启目录
autoCollapseToc = false # 目录自动展开/折叠
菜单栏语言
把name改成中文
menu.main]] # config your menu # 配置目录
name = "首页"
weight = 10
identifier = "home"
url = "/"
[[menu.main]]
name = "归档"
weight = 20
identifier = "archives"
url = "/post/"
[[menu.main]]
name = "标签"
weight = 30
identifier = "tags"
url = "/tags/"
[[menu.main]]
name = "分类"
weight = 40
identifier = "categories"
url = "/categories/"
添加关于页面
在content
目录下创建一个about
子目录,和post
同目录。
添加index.md
---
title: "关于我"
date: 2021-11-21T13:00:51+08:00
description: "码农在新加坡"
---
这里是内容
在config.toml
里面配置:
[[menu.main]]
name = "关于"
weight = 50
identifier = "about"
url = "/about/"
站点创建时间
since = "2020" # Site creation time # 站点建立时间
归档页显示文章总数
# show 'xx Posts In Total' in archive page ? # 是否在归档页显示文章的总数
showArchiveCount = true
显示字数统计和阅读时间
# show word count and read time ? # 是否显示字数统计与阅读时间
moreMeta = true
[params.utteranc] 是用来支持评论系统的。utterances 本来是一款基于 GitHub issues
的评论工具
[params.utterances] # https://utteranc.es/
owner = "left-pocket" # Your GitHub ID
repo = "left-pocket.github.io" # The repo to store comments
站点访问量统计
[params.busuanzi] # count web traffic by busuanzi # 是否使用不蒜子统计站点访问量
enable = true
siteUV = true
sitePV = true
pagePV = true
社交媒体外链
不需要的直接注释掉就可以,会自动在网站上隐藏图标。
[params.social] # 社交链接
a-email = "[email protected]"
g-github = "https://github.com/left-pocket"
i-zhihu = "https://www.zhihu.com/people/left-pocket"
# b-stack-overflow = "http://localhost:1313"
# c-twitter = "http://localhost:1313"
# d-facebook = "http://localhost:1313"
# e-linkedin = "http://localhost:1313"
# f-google = "http://localhost:1313"
# h-weibo = "http://localhost:1313"
# j-douban = "http://localhost:1313"
# k-pocket = "http://localhost:1313"
# l-tumblr = "http://localhost:1313"
# m-instagram = "http://localhost:1313"
# n-gitlab = "http://localhost:1313"
# o-bilibili = "http://localhost:1313"
百度谷歌收录
这个是用来让你的网站被百度谷歌收录的,在后续章节介绍
baiduVerification = "code-xxxxxxxx" # Baidu Verification
googleVerification = "xxxxxxxxxxxxxxxx" # Google Verification # 谷歌
<全文完>
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK