本站使用Hugo静态站点生成器,文章使用Markdown编写,内容托管在Cloudflare pages,评论系统使用utterances,页面访问计数使用busuanzi

安装与配置

安装Hugo

可以从Github直接下载hugo二进制文件,安装完成后通过检查版本确认环境就绪。

cp <path/to/your/hugo_binary_file> /usr/local/bin/
hugo version

创建站点

cd ~/git
hugo new site wanglifeng.site

选择主题

从Github下载hugo-PaperMod Release 6.0版本zip压缩包,并解压至themes目录。

配置文件

baseURL: https://wanglifeng.site
languageCode: zh-cn
title: 王李锋的个人网站
theme: PaperMod

enableInlineShortcodes: true
enableEmoji: true
enableGitInfo: true #This will update the Lastmod parameter for each page.
enableRobotsTXT: true
hasCJKLanguage: true

buildDrafts: false
buildFuture: false
buildExpired: false

paginate: 10

minify:
  disableXML: true
  minifyOutput: true

menu:
  main:
    - identifier: home
      name: 🏠主页
      url: /
      weight: 5 
    - identifier: archives
      name: ⏱ 时间轴
      url: /archives/
      weight: 10 
    - identifier: tags
      name: 🧩 标签
      url: /tags/
      weight: 20
    - identifier: search
      name: 🔍搜索
      url: search
      weight: 30
    - identifier: about
      name: 🙋🏻‍♂️ 关于
      url: about
      weight: 50

outputs:
  home:
    - HTML
    - RSS
    - JSON

params:
  comments: true
  defaultTheme: light
  disableThemeToggle: false
  ShowReadingTime: true
  ShowLastMod: true
  ShowWordCounts: true
  ShowCodeCopyButtons: true
  VisitCount: true
  ShowRssButtonInSectionTermList: true
  ShowToc: true
  TocOpen: true
  ShowPostNavLinks: true
  ShowShareButtons: true
  ShareButtons: ["linkedin", "twitter"]

  homeInfoParams:
      Title: "网络日志"
      Content: >
                    欢迎来到王李锋的个人网站。这里主要纪录日常学习、生活的点点滴滴。

  socialIcons:
    - name: github
      url: https://github.com/wanglf
    - name: twitter
      url: https://twitter.com/wesley_wang
    - name: email
      url: mailto:173952487#at#qq.com
    - name: stackoverflow
      url: https://stackoverflow.com/users/20181290/wanglifeng
    - name: bilibili
      url: https://space.bilibili.com/286525432
    - name: reddit
      url: https://www.reddit.com/user/hzwlf2002

  fuseOpts: 
    isCaseSensitive: false
    shouldSort: true
    location: 0
    distance: 1000
    threshold: 0.4
    minMatchCharLength: 0
    keys: [ "title", "permalink", "summary", "content"]

  Reward: true
  WechatPay: img/wechat_pay.png
  Alipay: img/alipay.png

  busuanzi:
    enable: true


pygmentsUseClasses: true
markup:
  highlight:
    noClasses: false
    lineNos: false
    codeFences: true
    guessSyntax: true
    tabWidth: 4
    style: monokai

本地预览

# buildDrafts
 hugo server -D

文章编写

新建页面

hugo new about.md

新建文章

hugo new posts/my-first-post.md

文章处理

hugo

文章发布

git add -A .
git commit -m "create post hello-world.md"
git push

参考资料

  1. https://gohugo.io/documentation/
  2. https://www.sulvblog.cn/posts/blog/
  3. https://github.com/xyming108/sulv-hugo-papermod
  4. https://dvel.me/tags/blog/
  5. https://blog.kanikig.xyz/hugo-busuanzi