推广

推荐 链接 教程
火麒麟翻墙VPN 注册链接 IEPL内网级专线机场推荐、无视墙敏感时期、解锁ChatGPT、奈飞流媒体
云狐不限时VPN 注册链接 不限时翻墙机场推荐,众多不限时套餐|大流量套餐|免费试用|畅享4K
长桥证券开户 文字教程 【视频教程】-长桥证券新加坡版开户入金教程:港美股永久免佣+0门槛开户
富途牛牛开户 文字教程 【视频教程】【富途牛牛】开户入金教程,投资美股必备券商 |领2100港币新手福利
Fomecard虚拟卡 注册链接 美国虚拟信用卡,轻松搞定ChatGPT4 Plus会员订阅
Pokepay虚拟卡 注册链接 Pokepay虚拟卡开卡使用教程,附大额开卡抵扣券,支持USDT,有实体卡

背景

使用个人博客也有一年多的时间,这一年多的时候踩了很多坑,也学到了很多知识。
这里分享一个系列教程:从零开始搭建个人博客,把我的经验分享在这里。
系列地址:https://techxiaofei.com

hugo高级配置,让你的博客更亮眼

当前我们已经把个人博客托管到了Github Pages里面了,也能使用浏览器访问我们的个人博客了。
我们需要修改一些主题配置,让我们的博客看起来更完善。

URL和语言

baseURL = "https://left-pocket.github.io"  // 你的博客主页
languageCode = "zh-cn"                     // 语言
defaultContentLanguage = "zh-cn"  

每页展示数量

根据自己想要展示的数量修改

paginate = 10  # 首页每页显示的文章数

开启目录

toc = true               # 是否开启目录
autoCollapseToc = false  # 目录自动展开/折叠

toc

菜单栏语言

把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/"

可以看到: about

站点创建时间

since = "2020"            # Site creation time          # 站点建立时间

归档页显示文章总数

# show 'xx Posts In Total' in archive page ?            # 是否在归档页显示文章的总数
showArchiveCount = true

显示字数统计和阅读时间

# show word count and read time ?                       # 是否显示字数统计与阅读时间
moreMeta = true

statistic

支持评论

[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

一开始需要安装: utterances

安装成功后: utterances

站点访问量统计

[params.busuanzi]         # count web traffic by busuanzi                             # 是否使用不蒜子统计站点访问量
  enable = true
  siteUV = true
  sitePV = true
  pagePV = true

busuanzi

社交媒体外链

不需要的直接注释掉就可以,会自动在网站上隐藏图标。

  [params.social]                                         # 社交链接
    a-email = "leftpocket12@gmail.com"
    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"

hugo_social

百度谷歌收录

这个是用来让你的网站被百度谷歌收录的,在后续章节介绍

baiduVerification = "code-xxxxxxxx"      # Baidu Verification
googleVerification = "xxxxxxxxxxxxxxxx"  # Google Verification         # 谷歌

<全文完>