Skip to content
0

配置说明

⚙️ 配置说明

基础配置

编辑 hugo-teek-site/hugo.toml

toml
baseURL = "https://yourdomain.com"
languageCode = "zh-CN"
title = "你的网站标题"
theme = "hugo-teek"

[params]
  description = "网站描述"
  keywords = ["关键词1", "关键词2"]

  # 博主信息
  [params.blogger]
    avatar = "https://your-avatar-url.jpg"
    name = "你的名字"
    slogan = "你的签名"

菜单配置

toml
# 一级菜单
[[menu.main]]
  name = "首页"
  url = "/"
  weight = 1

# 带下拉的菜单
[[menu.main]]
  name = "文档"
  url = "/docs/"
  weight = 2
  identifier = "docs"

  # 子菜单
  [[menu.main]]
    name = "运维"
    url = "/docs/linux/"
    weight = 1
    parent = "docs"

搜索配置 (Algolia)

toml
[params.algolia]
  enabled = true
  appId = "YOUR_APP_ID"
  apiKey = "YOUR_SEARCH_API_KEY"
  indexName = "YOUR_INDEX_NAME"

评论配置 (Twikoo)

toml
[params.comment]
  enabled = true
  provider = "twikoo"
  envId = "https://your-twikoo-url.com/"
  version = "1.6.41"

统计配置

toml
[params.analytics]
  # 百度统计
  [params.analytics.baidu]
    id = "YOUR_BAIDU_ID"

  # Google Analytics
  [params.analytics.google]
    id = "G-YOUR_GA_ID"

  # 不蒜子统计
  [params.analytics.busuanzi]
    enabled = true
    url = "https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"

代码高亮配置

toml
[markup.highlight]
  codeFences = true
  guessSyntax = true
  lineNos = true
  lineNumbersInTable = true
  noClasses = false
  style = "monokai"  # 可选: monokai, github, dracula 等
  tabWidth = 2

🎨 进阶使用

自定义首页 Hero

编辑 hugo-teek-site/data/heroBg.yaml 配置背景图:

yaml
list:
  - https://img1.example.com/bg1.jpg
  - https://img2.example.com/bg2.jpg
  - https://img3.example.com/bg3.jpg

配置副标题打字机效果(hugo.toml):

toml
[params.heroSubtitle]
  typeSpeed = 90        # 打字速度(毫秒/字符)
  deleteSpeed = 45      # 删除速度(毫秒/字符)
  hold = 1800           # 保持时间(毫秒)
  nextDelay = 600       # 下一句延迟(毫秒)
  shuffle = false       # 是否随机顺序

自定义分类卡片

在首页显示分类卡片:

toml
[params.category]
  enabled = true
  limit = 8             # 显示卡片数量
  autoPage = true       # 自动翻页
  pageSpeed = 4000      # 翻页速度(毫秒)

添加友链

创建 content/about/friend-links.md

markdown
---
title: "友情链接"
layout: "friends"
---

## 我的朋友们

这里是我的友链列表...

data/friends.yaml 中配置友链:

yaml
friends:
  - name: "示例网站"
    link: "https://example.com"
    avatar: "https://example.com/avatar.jpg"
    description: "这是一个示例网站"

多语言支持

编辑 hugo.toml 添加多语言配置:

toml
[languages]
  [languages.zh-cn]
    languageName = "简体中文"
    weight = 1

  [languages.en]
    languageName = "English"
    weight = 2

    [languages.en.params]
      description = "English Description"

最近更新