PaperMod主题配置&优化

编辑配置文件 Hugo默认配置文件格式是.toml,但.yml格式更易看懂,因此我们之前在新建站点时候执行的是hugo new site blog -f yml命令,因此生成的文件是.yml格式 配置文件内容请根据个人情况自行修改 baseURL: "https://muzi.gq/" # 绑定的域名 languageCode: zh-cn title: 萧的博客 theme: PaperMod # 主题名字,和themes文件夹下的一致 defaultContentLanguage: zh # 最顶部首先展示的语言页面 paginate: 10 # 每页显示的文章数 enableEmoji: true # 允许使用 Emoji 表情,建议 true outputs: home: - HTML - RSS - JSON params: env: production defaultTheme: auto description: "萧的博客" DateFormat: "2006-01-02" ShowReadingTime: true disableSpecial1stPost: true ShowPostNavLinks: true ShowBreadCrumbs: true ShowCodeCopyButtons: true ShowRssButtonInSectionTermList: true ShowToc: true # 显示目录 TocOpen: true # 自动展开目录 ShowLastMod: true #显示文章更新时间 assets: favicon: "x....

2023-12-21 · 2 分钟 · 萧

Hugo博客搭建教程

安装Hugo Windows用户推荐下载预构建的二进制版本 比如解压到D:\hugo,然后将目录添加到PATH环境变量中 Mac 用户如果已经安装 HomeBrew 工具,一行命令即可完成 brew install hugo 新建站点 进入指定目录新建blog,并将站点配置文件改为.yml后缀写法(官方推荐): hugo new site blog -f yml 添加主题 进入Hugo的官方主题网站 ,选择自己喜欢的主题。这里以PaperMod 主题为例演示,该主题提供三种安装方法 ,此处采用方法二安装: 进入网站的根目录,也就是blog文件夹所在路径执行 git submodule add --depth=1 https://github.com/adityatelange/hugo-PaperMod.git themes/PaperMod git submodule update --init --recursive # needed when you reclone your repo 使用该主题,在配置文件里输入主题的名字 theme: PaperMod 新建文章 创建一个hello-world页面: hugo new posts/hello-world.md 启动博客 在站点根目录下执行命令 hugo server -D 至此,一个基本的博客搭建完毕。

2023-12-19 · 1 分钟 · 萧