惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 叶小钗
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
SegmentFault 最新的问题
博客园 - 三生石上(FineUI控件)
雷峰网
雷峰网
WordPress大学
WordPress大学
有赞技术团队
有赞技术团队
博客园 - 【当耐特】
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
V
V2EX
V
Visual Studio Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 聂微东
P
Proofpoint News Feed
Last Week in AI
Last Week in AI
U
Unit 42
W
WeLiveSecurity
博客园 - Franky
Recent Announcements
Recent Announcements
Hacker News - Newest:
Hacker News - Newest: "LLM"
Attack and Defense Labs
Attack and Defense Labs
月光博客
月光博客
The Cloudflare Blog
Spread Privacy
Spread Privacy
腾讯CDC
P
Privacy International News Feed
N
News and Events Feed by Topic
AWS News Blog
AWS News Blog
NISL@THU
NISL@THU
T
Troy Hunt's Blog
小众软件
小众软件
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Microsoft Security Blog
Microsoft Security Blog
L
Lohrmann on Cybersecurity
Webroot Blog
Webroot Blog
Y
Y Combinator Blog
量子位
P
Palo Alto Networks Blog
N
News and Events Feed by Topic
V
Vulnerabilities – Threatpost
K
Kaspersky official blog
IT之家
IT之家
T
Threat Research - Cisco Blogs
Cloudbric
Cloudbric
云风的 BLOG
云风的 BLOG
C
Check Point Blog
Blog — PlanetScale
Blog — PlanetScale
爱范儿
爱范儿
G
Google Developers Blog
S
Secure Thoughts

豆逗子的小黑屋

GEMINI-CLI settings 参数详情 使用 sing-box Tun 模式实现 V2rayU 的透明代理 浅析 Claude Code 的执行与提示词 多模态模型是如何处理和理解图片的? 从配料表出发:便秘的猫应该怎么选主食 盘点开源的 DeepResearch 实现方案 浅谈 DeepSeek-R1 和 Kimi k1.5 论文中的思维链 + 强化学习 使用 TiDB Vector 构建 LightRAG 知识库 从论文到源码:详解 RAG 算法 云南之行——游在大理食在昆明 浅入浅出 Rerank 模型 一年同行:我的TiDB社区之旅 读书笔记《大语言模型》 TiDB Vector + Dify 快速构建 AI Agent 基于 LLM 推动游戏叙事 HTTP/2 和 CONTINUATION Flood 混合专家模型 (MoE) 笔记 报告分享: IMF第四次磋商报告 和 美联储研究笔记 使用 Coze 搭建 TiDB 助手 2023年总结 读书笔记《大规模语言模型:从理论到实践》 TiDB知识点梳理 (PCTA 笔记) 向量相似性检索方法 Java & Go 线程模式对比 Hugo + umami 博客统计面板 资产配置 101 探究 Spring-Boot 内置Server 搭建Go版本Kubernetes微服务示例 为什么Spring可以“自己注入自己” Go语言指针性能 从固定走向浮动 ——《时运变迁》读书笔记 Netty 源码分析及内存溢出思路 推荐 笔记 看得见的手——《置身事内》读书笔记 2022年初读书回顾 荐书:《走出唯一真理观》 关于 nintendo switch 邮箱
博客搭建简述
Weaxs · 2022-12-09 · via 豆逗子的小黑屋

Hugo 及其镜像 #

  具体文件详见 HUGO安装文档,下面主要解释一下docker部署的方式。

docker镜像地址:https://hub.docker.com/r/klakegg/hugo
github地址:https://github.com/klakegg/docker-hugo

  lakegg/hugo镜像有基于BusyboxAlpineDebianUbuntu4个系统.其中每个系统又分为normal、ext、onbuild、ci、ext-ci、ext-onbuild 6种,Busybox没有ext相关,下面简要介绍一下几种的区别

  • normal:只有基础的hugo命令。默认Entrypoint是hugo,所以common只需要写server,即可执行hogu server
  • ext:拓展版,在normal基础上添加了go、git、nodejs等拓展工具 (推荐)
  • ci: 主要用于持续集成/部署。在normal基础上,新增了环境变量HUGO_ENV,去掉了默认Entrypoint,需要自行添加容器运行命令
  • onbuild: 此版本主要用于编译构建并可以分开源码和产出。默认源码文件夹是/src,产出文件夹是.target,可以通过HUGO_DIR和HUGO_DESTINATION_ARG进行自定义设置。

docker镜像版本如下:

busybox Alpine Alpine with Asciidoctor Alpine with Pandoc Debian Ubuntu
normal latest
busybox
alpine asciidoctor pandoc debian ubuntu
ext - ext-alpine ext-asciidoctor ext-pandoc ext-debian ext-ubuntu
ci ci
busybox-ci
alpine-ci asciidoctor-ci pandoc-ci debian-ci ubuntu-ci
onbuild onbuild
busybox-onbuild
alpine-onbuild asciidoctor-onbuild ext-pandoc-onbuild debian-onbuild ubuntu-onbuild
ext-ci - ext-alpine-ci ext-asciidoctor-ci ext-pandoc-ci ext-debian-ci ext-ubuntu-ci
ext-onbuild - ext-alpine-onbuild ext-asciidoctor-onbuild ext-pandoc-onbuild ext-debian-onbuild ext-ubuntu-onbuild

hugo模板可以参考 https://themes.gohugo.io/

Blowfish模板使用 #

  Hugo的主题主要是用了blowfish,下面主要对blowfish的使用展开简要说明

  blowfish的github主要介绍了使用git submodules和Hugo的部署方式,这里主要介绍一下如何使用上面介绍的hugo docker镜像进行部署

  1. go.mod中添加blowfish
require github.com/nunocoracao/blowfish/v2 version // indirect
  1. config/_default/module.toml文件添加:
[[imports]]
path = "github.com/nunocoracao/blowfish/v2"
  1. 将根目录引用到镜像内的/src目录下,启动docker即可

  使用blowfish搭建博客,具体参考文档

自定义浏览器角标 #

  在favicon.io讲自己的图片生成为各种尺寸的icon,直接解压在favicon.io下载好的icon压缩包,并放在/static目录下即可

自定义ICON #

  将自定义的svg文件放在/asserts/icons目录下,为了使ICON和主题自适应,需要在svg文件中添加属性 fill=“currentColor” 如下:

<svg>
    <path fill="currentColor" d="xxx"/>
</svg>

中文字符数问题 #

  需要在 config/_default/config.toml 中添加属性,如下:

评论插件 #

  Hugo中的评论组件/服务可以参考 Comments。这里给出了十几种开源方案,大部分方案需要Docker或者Kubernetes部署。 此外有两种需要依赖 Github Discussions 或者 Github issues 的评论组件——giscusutterances。下面以giscus为例。

  在 blowfish 主题中添加 comment 可以参考 blowfish-Comments

  简单描述一下,添加文件 layouts/partials/comments.html,具体的内容参考giscus 中的示例:

<script src="https://giscus.app/client.js"
        data-repo="[在此输入仓库]"
        data-repo-id="[在此输入仓库 ID]"
        data-category="[在此输入分类名]"
        data-category-id="[在此输入分类 ID]"
        data-mapping="pathname"
        data-strict="0"
        data-reactions-enabled="1"
        data-emit-metadata="0"
        data-input-position="bottom"
        data-theme="preferred_color_scheme"
        data-lang="zh-CN"
        crossorigin="anonymous"
        async>
</script>

GitHub Page 部署 Hugo #

  在 .github/workflows 目录下添加yml,文档参考Host on GitHub Pages,具体的yml内容示例如下:

name: Deploy Hugo site to Pages

on:
  push:
    branches: ["main"]
  workflow_dispatch:

permissions:
  contents: read
  pages: write
  id-token: write

concurrency:
  group: "pages"
  cancel-in-progress: false

# Default to bash
defaults:
  run:
    shell: bash

jobs:
  # 构建
  build:
    runs-on: ubuntu-latest
    env:
      # Hugo 版本
      HUGO_VERSION: 0.121.0
    steps:
      - name: Install Hugo CLI
        run: |
          wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
          && sudo dpkg -i ${{ runner.temp }}/hugo.deb
      - name: Install Dart Sass
        run: sudo snap install dart-sass
      - name: Checkout
        uses: actions/checkout@v3
        with:
          submodules: recursive
      - name: Setup Pages
        id: pages
        uses: actions/configure-pages@v3
      - name: Install Node.js dependencies
        run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
      - name: Build with Hugo
        env:
          HUGO_ENVIRONMENT: production
          HUGO_ENV: production
        run: |
          hugo \
            --minify \
            # 博客地址
            --baseURL "https://example.com"
      - name: Upload artifact
        uses: actions/upload-pages-artifact@v2
        with:
          # hugo 构建后默认生成到 public 目录下
          path: ./public

  # 部署
  deploy:
    environment:
      name: github-pages
      # 博客地址
      url: https://example.com
    runs-on: ubuntu-latest
    needs: build
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v2

集成 Umami 的站点统计 #

这部分写到另一个文章中了,具体可以看这个

Hugo + umami 博客统计面板