Loading...

Loading...

Global Configuration

This page covers the blog’s global configuration: site info, URL & permalinks, theme basics (Logo/Favicon), banner background, and the CDN mechanism. This is the foundation of the whole blog — every other config chapter builds on top of it.

Config has two layers: site config _config.yml (Hexo core + plugins) and theme config (layout/appearance/interaction). In this project the theme config file is overwritten by the userConfig/_config.tmp.yml template during CI builds — edit the template for theme config changes (see the Installation & Theme Config chapter). Unless marked “root config”, everything on this page is theme config.

How to read: every section follows “How to enable → Common options → All tunable keys → Boundaries & conflicts”. See the effect first, then the corresponding config that produces it — copy and use.

1. Site Info

Purpose: site name, subtitle, description, author and other basic info; affects the title bar, SEO and site-wide text.

Learning path: How to enable → Common options → All tunable keys → Boundaries & conflicts

1.1 How to enable

Effect: the browser tab shows “夜法之书”, the header shows the site name and subtitle, and search results / share cards use description.

Corresponding config (root config _config.yml):

title: 夜法之书
subtitle: '深度思考,深入生活!所有文章均持续滚动更新!'
description: '~软件驱动世界~个人独立技术博客,关于Linux,开源,Nas,Docker,嵌入式,理财,健身等主题!'
author: 夜法之书
language: zh-CN
timezone: Asia/Shanghai

1.2 Common options

① Site title and subtitle

Effect: title appears in the tab and the header; subtitle appears in the banner typewriter and under the header.

Corresponding config:

title: 夜法之书
subtitle: '深度思考,深入生活!'

② Site description

Effect: the SEO meta description and the RSS description use this text.

Corresponding config:

description: '个人独立技术博客'

③ Author fallback

Effect: when a post’s front-matter has no author, the page shows this; if set, front-matter wins.

Corresponding config:

author: 夜法之书

④ Language and timezone

Effect: language decides html lang and date localization; timezone decides which timezone post dates are rendered in.

Corresponding config:

language: zh-CN
timezone: Asia/Shanghai

1.3 All tunable keys

KeyTypeDefaultOptions/RangePurpose
titlestring—any stringsite title
subtitlestring—any stringsite subtitle
descriptionstring—any stringSEO description
authorstring—any stringsite-wide default author
languagestringzh-CNlanguage codesite language
timezonestring—IANA timezone, e.g. Asia/Shanghaidate timezone

1.4 Boundaries & conflicts

  • author is the fallback author for posts — used when the post’s front-matter has no author.
  • language affects the site html lang attribute and date localization.
  • timezone must match your readers’ timezone, otherwise post dates will shift.
  • These keys live in the root config, outside the scope of userConfig/_config.tmp.yml overrides.

1.5 Summary

  • Minimum viable: title + author + language
  • SEO: write description carefully
  • Dates shifted: check timezone first
  • Changes not taking effect: did you edit the root _config.yml?

Purpose: the site root URL and post link format. This blog uses abbrlink (CRC32 + hex) for short links, permanent after publishing.

Learning path: How to enable → Common options → All tunable keys → Boundaries & conflicts

2.1 How to enable

Effect: post links look like https://blog.17lai.site/posts/8f9792ab/ — short and unrelated to the title; retitling a post doesn’t change its link.

Corresponding config (root config _config.yml):

url: https://blog.17lai.site
permalink: posts/:abbrlink/

abbrlink:
  alg: crc32
  rep: hex

2.2 Common options

① Site root URL

Effect: canonical, sitemap and RSS absolute links are prefixed with it; a wrong value makes every outbound link point at the wrong domain.

Corresponding config:

url: https://blog.17lai.site

② Link format

Effect: post URLs become /posts/<abbrlink>/; changing the format breaks all existing links.

Corresponding config:

permalink: posts/:abbrlink/

③ Hash algorithm and representation

Effect: crc32 + hex produces 8-character hex short links; switching algorithms only affects new posts, since old abbrlinks are already written into front-matter.

Corresponding config:

abbrlink:
  alg: crc32
  rep: hex

④ Whether drafts get short links

Effect: with drafts: true drafts also get an abbrlink; the default false generates it only on publish.

Corresponding config:

abbrlink:
  drafts: true

2.3 All tunable keys

KeyTypeDefaultOptions/RangePurpose
urlstring—full site URLabsolute-link base
permalinkstring—path template, e.g. posts/:abbrlink/post link format
abbrlink.algstringcrc16crc16 / crc32hash algorithm
abbrlink.repstringdecdec / hexrepresentation
abbrlink.draftsboolfalsetrue / falsegenerate for drafts
abbrlink.forceboolfalsetrue / falseforce recompute (ignores cache, use with care)
abbrlink.writebackboolfalsetrue / falsewrite back to source files

2.4 Boundaries & conflicts

  • writeback: false (since 2026-09-22) means the plugin does not write back to source files — it was disabled because a resident hexo server that reads a file mid-edit (empty) would clobber the source with a truncated object (see docs/EXPERIENCE.md §55).
  • abbrlink is written into each post’s front-matter on first generation and stays fixed thereafter, so renaming posts won’t break old links.
  • url is the base of all absolute links (canonical, sitemap, RSS) — it must match the deployment domain in production.
  • force: true recomputes every short link, which invalidates all published links — only use it for a deliberate migration.

2.5 Summary

  • Minimum viable: url + permalink
  • Short links: alg: crc32 + rep: hex
  • Don’t enable force: it kills old links
  • Don’t enable writeback: the resident server can clobber source files

3. Theme Basics: Logo & Favicon

Purpose: site icon and header logo, currently sharing the same image.

Learning path: How to enable → Common options → All tunable keys → Boundaries & conflicts

3.1 How to enable

Effect: the browser tab shows a custom icon; the left side of the header shows the same image as the logo.

Corresponding config (theme config):

favicon: /favicon.webp
logo: /favicon.webp

3.2 Common options

① Change the site icon

Effect: the tab icon changes (webp/png/ico supported).

Corresponding config:

favicon: /my-icon.png

② Change the header logo

Effect: the graphic on the left of the navbar changes; a separate horizontal logo is recommended.

Corresponding config:

logo: /my-logo.webp

③ Default trad/simp conversion direction

Effect: the Chinese trad/simp conversion feature defaults to simplified or traditional.

Corresponding config:

zhDefaultEncoding: 2

3.3 All tunable keys

KeyTypeDefaultOptions/RangePurpose
faviconstring—image pathbrowser tab icon
logostring—image pathheader logo
zhDefaultEncodingnumber21 (繁體) / 2 (简体)default trad/simp direction

3.4 Boundaries & conflicts

  • Images placed at the source/ root are served statically.
  • zhDefaultEncoding is the default direction of the Chinese trad/simp conversion feature, paired with preference.translate (see the Multilingual & Wiki System chapter).
  • Browsers may cache the old favicon after replacement — force a refresh.

3.5 Summary

  • Minimum viable: favicon + logo
  • Brand feel: design the logo and favicon separately
  • Icon not updating: clear the browser cache

4. Banner Background

Purpose: the header banner image on all pages. Supports daily rotation, random images, parallax scrolling, plus a typewriter subtitle overlay.

Learning path: How to enable → Common options → All tunable keys → Boundaries & conflicts

4.1 How to enable

Effect: a large background image appears at the top of the page, with the subtitle typed out letter by letter and a blinking cursor.

Corresponding config (theme config):

banner:
  enable: true
  random: true

4.2 Common options

① Daily rotation / fixed image

Effect: with enable: true a new image is picked each day; with false it always uses /medias_webp/banner/0.webp.

Corresponding config:

banner:
  enable: false

② Random image

Effect: picks a random image from featureImages; combined with enable: true this gives “a new image every day”.

Corresponding config:

banner:
  random: true

③ Parallax scrolling

Effect: when scrolling down, the background image and content move at different speeds, creating depth.

Corresponding config:

banner:
  parallax: true

④ Prevent over-cropping on mobile

Effect: constrains the minimum image aspect ratio so portrait screens don’t crop the image into a strip; 0 disables the constraint.

Corresponding config:

banner:
  width_height_ratio: 1.0

⑤ Typewriter subtitle

Effect: the subtitle appears letter by letter, can loop, and can show a cursor.

Corresponding config:

banner:
  typed:
    enable: true
    loop: false
    showCursor: true
    cursorChar: "_"

⑥ Typing speed

Effect: a larger typeSpeed types slower, a larger backSpeed deletes faster, and startDelay controls the pause before starting.

Corresponding config:

banner:
  typed:
    startDelay: 100
    typeSpeed: 80
    backSpeed: 50

4.3 All tunable keys

KeyTypeDefaultOptions/RangePurpose
banner.enablebooltruetrue / falsedaily banner switch; false uses /medias_webp/banner/0.webp
banner.randombooltruetrue / falserandom featureimages image
banner.parallaxboolfalsetrue / falseparallax scrolling
banner.width_height_rationumber1.00 (off) / positive numberminimum image aspect ratio
banner.typed.enablebooltruetrue / falsetypewriter effect
banner.typed.loopboolfalsetrue / falsewhether to loop
banner.typed.showCursorbooltruetrue / falseshow cursor
banner.typed.cursorCharstring"_"single charactercursor character
banner.typed.startDelaynumber100millisecondsstart delay
banner.typed.typeSpeednumber80milliseconds/chartyping speed
banner.typed.backSpeednumber50milliseconds/chardeleting speed

4.4 Boundaries & conflicts

  • With random: true images are picked from featureimages; combined with enable: true this gives “a new image every day”.
  • The typed typewriter renders the subtitle (the site subtitle or the homepage index.slogan.text, see the Navigation Menu & Homepage chapter).
  • When background.image.random is enabled the post banner is hidden (see the Post Page Config chapter §1).

4.5 Summary

  • Minimum viable: enable: true
  • Fixed image: enable: false
  • Want motion: parallax + typed
  • Portrait cropping: adjust width_height_ratio

5. CDN Mechanism

Purpose: serve all static assets (JS/CSS/images) via CDN. This project uses jsDelivr + placeholder injection: templates contain {cdnPathVersion} and other placeholders, replaced with real CDN URLs at CI build time.

Learning path: How to enable → Common options → All tunable keys → Boundaries & conflicts

5.1 How to enable

Effect: after building, JS/CSS links in the pages point to jsDelivr versioned paths and the browser loads from the CDN; a direct local hexo generate still keeps the placeholders (unreplaced).

Corresponding config (theme config):

jsDelivr:
  url: {cdnPathVersion}

cdn:
  url: "{cdnUrl}"
  mediaUrl: "{mediaUrl}"
  resUrl: "{resUrl}"

5.2 Common options

① Versioned CDN path

Effect: asset URLs carry a version like @1.1, so browsers fetch new files after a release.

Corresponding config:

jsDelivr:
  url: {cdnPathVersion}

② latest path

Effect: always points at the latest version (not recommended in production — cache is uncontrollable). Currently commented out and not enabled.

Corresponding config:

jsDelivr:
  latesturl: #{cdnPathLatest}

③ Three asset domains

Effect: JS/CSS, images/media and other resources are loaded from their own domains.

Corresponding config:

cdn:
  url: "{cdnUrl}"
  mediaUrl: "{mediaUrl}"
  resUrl: "{resUrl}"

5.3 All tunable keys

KeyTypeDefaultOptions/RangePurpose
jsDelivr.urlstring—URL containing {cdnPathVersion}versioned CDN path
jsDelivr.latesturlstring—URL containing {cdnPathLatest}latest path (currently commented)
cdn.urlstring—contains {cdnUrl}JS/CSS CDN
cdn.mediaUrlstring—contains {mediaUrl}image/media CDN
cdn.resUrlstring—contains {resUrl}resource CDN (default https://cfblog.17lai.site)

Placeholders and build-time replacement (done by userConfig/_config.tmp.yml + tools/cicd.sh sed):

PlaceholderReplaced withExample
{cdnPathVersion}jsDelivr versioned pathhttps://cdn.jsdelivr.net/gh/appotry/hexo@1.1
{cdnPathLatest}latest CDN pathhttps://cdn.jsdelivr.net/gh/appotry/hexo@latest
{urlVersion}file version number?v={urlVersion}
{cdnUrl} / {mediaUrl} / {resUrl}CDN domainshttps://cfblog.17lai.site

5.4 Boundaries & conflicts

  • When writing config here you don’t need to care about placeholders — keep {xxx} as-is, CI handles it.
  • Release timing: after changing JS/CSS run tools/cicd.sh -r "feature" to bump the version (tools/.VERSION), otherwise browsers/PWA cache the old version; content-only changes use -c or -d.
  • A direct hexo generate does not replace placeholders, so assets 404 — you must go through the CI scripts.

5.5 Summary

  • Minimum viable: leave the template placeholders untouched
  • Changing assets: must use -r to bump the version
  • Don’t use latest: production cache is uncontrollable
  • Local 404: CI injection was skipped

6. Site Running Time (time)

Purpose: show “This site has been running for N years N days” in the footer, counted from the configured launch date.

Learning path: How to enable → Common options → All tunable keys → Boundaries & conflicts

6.1 How to enable

Effect: the footer shows “This site has been running for 6 years 3 months 12 days”, and the numbers grow automatically over time.

Corresponding config (theme config):

time:
  enable: true
  year: 2020
  month: 06
  date: 28
  hour: 00
  minute: 00
  second: 00

6.2 Common options

① Change the launch date

Effect: the running duration is recalculated from the new date.

Corresponding config:

time:
  year: 2021
  month: 01
  date: 01

② Turn off the running time

Effect: the footer no longer shows the running duration.

Corresponding config:

time:
  enable: false

6.3 All tunable keys

KeyTypeDefaultOptions/RangePurpose
time.enablebooltruetrue / falserunning-time switch
time.yearnumber—yearlaunch year
time.monthnumber—1–12launch month
time.datenumber—1–31launch day
time.hournumber—0–23hour
time.minutenumber—0–59minute
time.secondnumber—0–59second

6.4 Boundaries & conflicts

  • Set the time to when the blog first went live; the footer automatically calculates and displays the running duration.
  • Keep the leading 0 in month (e.g. 06) to avoid YAML parsing ambiguity.

6.5 Summary

  • Minimum viable: enable + year/month/day
  • Just launched: use today’s date
  • Don’t want to show it: enable: false

Purpose: show a “Fork Me on GitHub” corner badge in the header, linking to your repository.

Learning path: How to enable → Common options → All tunable keys → Boundaries & conflicts

7.1 How to enable

Effect: a diagonal “Fork Me on GitHub” ribbon appears in the top-right corner; clicking it jumps to the repository.

Corresponding config (theme config):

githubLink:
  enable: true
  url: https://github.com/appotry/hexo
  title: Fork Me

7.2 Common options

① Change the repository URL

Effect: clicking the badge jumps to your repository.

Corresponding config:

githubLink:
  url: https://github.com/you/your-repo

② Change the copy

Effect: the text on the ribbon changes.

Corresponding config:

githubLink:
  title: View Source

7.3 All tunable keys

KeyTypeDefaultOptions/RangePurpose
githubLink.enableboolfalsetrue / falsebadge switch
githubLink.urlstring—repository URLtarget address
githubLink.titlestringFork Meany stringbadge text

7.4 Boundaries & conflicts

  • With enable: true the badge shows in the header; url points to your GitHub repository.
  • This and the GitHub link in the navigation menu are two independent entry points — you can keep just one.

7.5 Summary

  • Minimum viable: enable + url
  • Keep it subtle: leave it disabled
  • Localize the copy: change title

8. Theme Colors (color)

Purpose: site-wide color scheme — PWA theme color, background, navbar, text, with light/dark pairs. Use custom CSS for colors not covered here.

Learning path: How to enable → Common options → All tunable keys → Boundaries & conflicts

8.1 How to enable

Effect: the site background, navbar, body text and secondary text are colored by config; switching to dark mode automatically uses the *_dark values.

Corresponding config (theme config):

color:
  theme_color: "#7e9fc4"
  body_bg_color: "#eee"
  body_bg_color_dark: "#181c27"

8.2 Common options

① Background color (light/dark)

Effect: the page background changes, with cards floating on top.

Corresponding config:

color:
  body_bg_color: "#f5f5f5"
  body_bg_color_dark: "#181c27"

② Navbar colors

Effect: the top menu background and text colors change.

Corresponding config:

color:
  navbar_bg_color: "rgba(255, 255, 255, 0.8)"
  navbar_text_color: "#f8f8f8"

③ Body and secondary text

Effect: the body text gets darker/lighter; secondary text such as excerpts uses sec_text_color.

Corresponding config:

color:
  text_color: "#3c4858"
  sec_text_color: "#718096"

④ PWA theme color

Effect: the mobile browser address bar and the PWA splash screen use this color (manifest + theme-color meta).

Corresponding config:

color:
  theme_color: "#7e9fc4"

8.3 All tunable keys

KeyTypeDefaultOptions/RangePurpose
color.theme_colorstring"#7e9fc4"color valuePWA theme color
color.body_bg_colorstring"#eee"color valuebody background
color.body_bg_color_darkstring"#181c27"color valuedark background
color.navbar_bg_colorstring"rgba(255, 255, 255, 0.8)"color valuetop menu background
color.navbar_bg_color_darkstring"#1f3144"color valuedark menu background
color.navbar_text_colorstring"#f8f8f8"color valuetop menu text
color.navbar_text_color_darkstring"#d0d0d0"color valuedark menu text
color.subtitle_colorstring"#f8f8f8"color valuesubtitle color
color.subtitle_color_darkstring"#d0d0d0"color valuedark subtitle color
color.text_colorstring"#3c4858"color valueglobal text
color.text_color_darkstring"#c4c6c9"color valuedark text
color.sec_text_colorstring"#718096"color valuesecondary text
color.sec_text_color_darkstring"#a7a9ad"color valuedark secondary text

8.4 Boundaries & conflicts

  • Every color key has a matching *_dark value — adjust both when changing colors.
  • Color inspiration: LOL Colors.
  • Colors ultimately flow through three layers: _variables/base.styl → :root CSS variables → color-schema.styl; writing .css directly gets overwritten by the build.

8.5 Summary

  • Minimum viable: change only theme_color
  • Full re-skin: change light and dark pairs together
  • Don’t change only half: missing *_dark makes dark mode jarring
  • Style changes go in .styl: don’t touch build artifacts

9. Fonts (font)

Purpose: site-wide body font size, font family, letter spacing and code font size.

Learning path: How to enable → Common options → All tunable keys → Boundaries & conflicts

9.1 How to enable

Effect: the body renders at the specified size and font family, and the code block size scales proportionally to the body.

Corresponding config (theme config):

font:
  font_size: 16px
  font_family:
  letter_spacing: 0.02em
  code_font_size: 85%

9.2 Common options

① Body font size

Effect: site-wide body text gets larger/smaller, with line height following proportionally.

Corresponding config:

font:
  font_size: 18px

② Font family

Effect: leaving it empty uses the theme’s default font stack; filling in a font name prioritizes that font (it must exist on the user’s machine or already be loaded).

Corresponding config:

font:
  font_family: "Noto Sans SC"

③ Letter spacing

Effect: the spacing between Chinese characters changes, making CJK typography looser/tighter.

Corresponding config:

font:
  letter_spacing: 0.05em

④ Code font size

Effect: code block text scales as a percentage of the body; 85% is slightly smaller than the body.

Corresponding config:

font:
  code_font_size: 90%

9.3 All tunable keys

KeyTypeDefaultOptions/RangePurpose
font.font_sizestring16pxCSS length with unitbody font size
font.font_familystringempty (theme default)font family namebody font
font.letter_spacingstring0.02emCSS lengthletter spacing
font.code_font_sizestring85%percentagecode font size (relative to body)

9.4 Boundaries & conflicts

  • Leaving font_family empty uses the theme’s default font stack; code font size scales as a percentage of the body size.
  • Custom fonts require loading the font files yourself (the theme does not pull web fonts automatically).
  • Font size and the §10 design.font_size_* are two systems: font.font_size is the body baseline, design.font_size_* is the component size scale.

9.5 Summary

  • Minimum viable: change only font_size
  • Looser CJK: adjust letter_spacing
  • Code too small: code_font_size: 90%
  • Font not applying: the user’s machine lacks that font

10. Design Tokens (design)

Purpose: design tokens for radius/shadow/transition/gradient/spacing/font-size scales, mapped to CSS variables by color-schema.styl and referenced by all components.

Learning path: How to enable → Common options → All tunable keys → Boundaries & conflicts

10.1 How to enable

Effect: card radius, hover shadows, button gradients, component spacing and font sizes all render from tokens; change one token and every element of the same kind changes site-wide.

Corresponding config (theme config):

design:
  radius_md: 8px
  shadow_md: "0 2px 5px 0 rgba(0,0,0,0.16)"
  transition_normal: 0.3s
  space_4: 16px
  font_size_md: 1.125rem

10.2 Common options

① Radius

Effect: radius_sm affects buttons/small tags, radius_md cards, radius_lg modals, radius_pill capsules, radius_full circles.

Corresponding config:

design:
  radius_sm: 3px
  radius_md: 8px
  radius_lg: 12px
  radius_pill: 999px
  radius_full: 50%

② Shadows

Effect: shadow_sm for hover micro-shadows, shadow_md for default cards, shadow_lg for card hover, shadow_xl for modals/overlays; dark mode uses *_dark.

Corresponding config:

design:
  shadow_sm: "0 1px 3px 0 rgba(0,0,0,0.12)"
  shadow_md: "0 2px 5px 0 rgba(0,0,0,0.16)"
  shadow_md_dark: "0 2px 5px 0 rgba(0,0,0,0.45)"

③ Transition durations

Effect: fast for hover feedback, normal for panel/modal expansion.

Corresponding config:

design:
  transition_fast: 0.2s
  transition_normal: 0.3s

④ Gradients

Effect: gradient_primary for navbar/buttons, gradient_accent for card decoration.

Corresponding config:

design:
  gradient_primary: "linear-gradient(to right, #4facfe, #00f2fe)"
  gradient_accent: "linear-gradient(135deg, #667eea, #764ba2)"

⑤ Spacing and font-size scales

Effect: component padding takes values from space_*; font sizes take values from font_size_* and scale with --font-scale.

Corresponding config:

design:
  space_1: 4px
  space_4: 16px
  font_size_md: 1.125rem
  font_size_2xl: 2rem

10.3 All tunable keys

KeyTypeDefaultOptions/RangePurpose
design.radius_smstring3pxCSS lengthbutton/small-tag radius
design.radius_mdstring8pxCSS lengthcard/note radius
design.radius_lgstring12pxCSS lengthmodal radius
design.radius_pillstring999pxCSS lengthcapsule radius
design.radius_fullstring50%percentagecircle
design.shadow_smstring"0 1px 3px 0 rgba(0,0,0,0.12)"CSS box-shadowhover micro-shadow
design.shadow_mdstring"0 2px 5px 0 rgba(0,0,0,0.16)"CSS box-shadowdefault card shadow
design.shadow_lgstring"0 5px 11px 0 rgba(0,0,0,0.18)"CSS box-shadowcard hover
design.shadow_xlstring"0 10px 30px 0 rgba(0,0,0,0.2)"CSS box-shadowmodal/overlay
design.shadow_sm_darkstring"0 1px 3px 0 rgba(0,0,0,0.4)"CSS box-shadowdark micro-shadow
design.shadow_md_darkstring"0 2px 5px 0 rgba(0,0,0,0.45)"CSS box-shadowdark card shadow
design.shadow_lg_darkstring"0 5px 11px 0 rgba(0,0,0,0.5)"CSS box-shadowdark hover
design.shadow_xl_darkstring"0 10px 30px 0 rgba(0,0,0,0.55)"CSS box-shadowdark overlay
design.transition_faststring0.2sCSS timehover feedback
design.transition_normalstring0.3sCSS timepanel/modal
design.gradient_primarystring—CSS gradientnavbar/buttons
design.gradient_accentstring—CSS gradientcard decoration
design.space_1string4pxCSS lengthspacing scale 1
design.space_2string8pxCSS lengthspacing scale 2
design.space_3string12pxCSS lengthspacing scale 3
design.space_4string16pxCSS lengthspacing scale 4
design.space_5string24pxCSS lengthspacing scale 5
design.font_size_xsstring0.75remremfont-size scale xs
design.font_size_smstring0.875remremfont-size scale sm
design.font_size_mdstring1.125remremfont-size scale md
design.font_size_lgstring1.25remremfont-size scale lg
design.font_size_xlstring1.5remremfont-size scale xl
design.font_size_2xlstring2remremfont-size scale 2xl

10.4 Boundaries & conflicts

  • This is the theme’s design-system layer — components reference these tokens, so one change applies globally.
  • Keep the scale system when adjusting (radius/shadow/spacing each form a ladder); don’t break consistency by changing a single value.
  • Font sizes are rem-based and scale with the root --font-scale variable (site-wide proportional scaling when the user adjusts font size) — don’t replace them with fixed px values.
  • Colors are not in this section: colors live in the §8 color section.

10.5 Summary

  • Minimum viable: adjust only radius_md / shadow_md
  • Change the style: change the whole group, keep the ladder
  • Don’t use px for font sizes: keep rem
  • Colors go to §8: this section only covers radius/shadow/spacing

11. Web Analytics (web_analytics)

Purpose: site-wide visitor analytics, supporting Baidu Analytics, Google Analytics 4 and self-hosted umami — all can run simultaneously.

Learning path: How to enable → Common options → All tunable keys → Boundaries & conflicts

11.1 How to enable

Effect: after the page loads it reports PV/UV to the analytics service; the footer can show total visits and total visitors.

Corresponding config (theme config):

web_analytics:
  enable: true
  umami:
    enable: true
    src: https://ana.17lai.site/script.js
    api_server: https://ana.17lai.site
    website_id: "your-website-id"

11.2 Common options

① Turn off analytics

Effect: no analytics script is injected at all.

Corresponding config:

web_analytics:
  enable: false

② Respect DNT

Effect: visitors whose browser has “Do Not Track” enabled are not counted.

Corresponding config:

web_analytics:
  follow_dnt: true

③ Baidu Analytics

Effect: data goes to the Baidu Analytics dashboard.

Corresponding config:

web_analytics:
  baidu:
    enable: true
    id: your-baidu-id

④ Google Analytics 4

Effect: data goes to the GA4 property.

Corresponding config:

web_analytics:
  google:
    enable: true
    measurement_id: 'G-XXXXXXXXXX'

⑤ umami footer PV/UV

Effect: the footer shows total visits and total visitors (with footer.statistics).

Corresponding config:

web_analytics:
  umami:
    totalTraffic: true
    totalNumberOfvisitors: true

⑥ Analytics start time and API

Effect: only data after start_time is counted; api_server and website_id decide which instance to read from.

Corresponding config:

web_analytics:
  umami:
    start_time: '2023-01-01'
    api_server: https://ana.17lai.site
    website_id: "your-website-id"

11.3 All tunable keys

KeyTypeDefaultOptions/RangePurpose
web_analytics.enablebooltruetrue / falseanalytics master switch
web_analytics.follow_dntboolfalsetrue / falserespect DNT
web_analytics.baidu.enableboolfalsetrue / falseBaidu Analytics
web_analytics.baidu.idstring—Baidu Analytics IDsite identifier
web_analytics.baiduPushboolfalsetrue / falseBaidu Search Resource submission
web_analytics.google.enableboolfalsetrue / falseGA4
web_analytics.google.measurement_idstring—starts with G-GA4 property
web_analytics.umami.enablebooltruetrue / falseumami
web_analytics.umami.totalTrafficbooltruetrue / falsefooter total visits
web_analytics.umami.totalNumberOfvisitorsbooltruetrue / falsefooter total visitors
web_analytics.umami.pageStatsbooltruetrue / falsepage stats
web_analytics.umami.srcstring—JS URLumami script
web_analytics.umami.start_timestring'2023-01-01'YYYY-MM-DD (must be quoted)analytics start time
web_analytics.umami.tokenstring—viewOnly tokenadvanced stats
web_analytics.umami.api_serverstring—server URLumami server
web_analytics.umami.website_idstring—site IDumami site

11.4 Boundaries & conflicts

  • umami’s totalTraffic/totalNumberOfvisitors drive the footer PV/UV display (with footer.statistics).
  • start_time should be when the umami site was created and must be quoted, otherwise YAML parses it as a Date object and JSON.stringify turns it into {}.
  • token requires creating a viewOnly user in the umami admin.
  • All three analytics can run simultaneously, but that double-reports; usually keep just one.

11.5 Summary

  • Minimum viable: enable + umami’s src / website_id
  • Footer PV/UV: totalTraffic + totalNumberOfvisitors
  • Always quote start_time
  • Don’t enable all three: duplicate reporting

Appendix: Global Config Quick Reference

Config itemLocationDescription
title / subtitle / descriptionroot _config.ymlsite basic info
author / language / timezoneroot _config.ymlauthor fallback, language, timezone
url / permalinkroot _config.ymlsite root URL + posts/:abbrlink/ link format
abbrlinkroot _config.ymlcrc32+hex short links, writeback: false (no writeback, prevents resident-server clobbering)
logo / favicontheme configheader logo and site icon
zhDefaultEncodingtheme configdefault trad/simp conversion direction
bannertheme configdaily rotation/random images/parallax/typewriter
jsDelivr / cdntheme configCDN placeholders (replaced at CI time)
timetheme configfooter running duration
githubLinktheme configFork Me badge
colortheme configsite-wide light/dark colors
fonttheme configfont size/family/letter spacing
designtheme configradius/shadow/transition/gradient/spacing/font-size tokens
web_analyticstheme configBaidu/GA4/umami analytics

Suggested reading order: configure §1–§3 first (site identity and icons), then §4 (banner look), then §6–§10 (footer, colors, fonts, tokens), and finally §11 analytics. §5 CDN is only for release troubleshooting — leave the placeholders untouched day to day.

Comments
Data Loading...