Skip to content

Commit 123f38f

Browse files
committed
bump hugo to 1.161
1 parent e399d22 commit 123f38f

24 files changed

Lines changed: 3841 additions & 14 deletions

.github/workflows/page.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
build:
2020
runs-on: ubuntu-latest
2121
env:
22-
HUGO_VERSION: 0.157.0
22+
HUGO_VERSION: 0.161.0
2323
steps:
2424
- name: Checkout
2525
uses: actions/checkout@v4
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{{- $.Scratch.Add "offline-search-index" slice -}}
2+
{{- range hugo.Sites -}}
3+
{{- range where .Pages ".Params.exclude_search" "!=" true -}}
4+
{{- /* We have to apply `htmlUnescape` again after `truncate` because `truncate` applies `html.EscapeString` if the argument is not HTML. */ -}}
5+
{{- /* Individual taxonomies can be added in the next line by add '"taxonomy-name" (.Params.taxonomy-name | default "")' to the dict (as seen for categories and tags). */ -}}
6+
{{- $.Scratch.Add
7+
"offline-search-index"
8+
(dict
9+
"ref" .RelPermalink
10+
"title" .Title
11+
"categories" (.Params.categories | default "")
12+
"tags" (.Params.tags | default "")
13+
"description" (.Description | default "")
14+
"body" (.Plain | htmlUnescape)
15+
"excerpt" ((.Description | default .Plain) | htmlUnescape | truncate (.Site.Params.offlineSearchSummaryLength | default 70) | htmlUnescape)
16+
)
17+
-}}
18+
{{- end -}}
19+
{{- end -}}
20+
{{- $.Scratch.Get "offline-search-index" | jsonify -}}

hugo.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#=======================================#
44
baseURL: https://pigsty.cc/
55
title: PIGSTY
6-
languageCode: zh-CN
6+
locale: zh-CN
77
defaultContentLanguage: zh-cn
88
enableRobotsTXT: true
99
enableGitInfo: true

layouts/_default/price.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,9 @@ <h2 class="section-title">功能对比</h2>
316316
<tr>
317317
<td>响应时间</td>
318318
<td>-</td>
319-
<td>48 小时</td>
320-
<td class="highlight">24 小时</td>
321-
<td>30 分钟</td>
319+
<td>工作日内</td>
320+
<td class="highlight">&lt; 4 小时</td>
321+
<td>&lt; 30 分钟</td>
322322
</tr>
323323
<tr>
324324
<td>服务时间</td>
@@ -398,7 +398,7 @@ <h2 class="section-title">增值服务</h2>
398398
</div>
399399
<h3 class="service-title">挂专家号</h3>
400400
<p class="service-desc">快速诊断一个数据库问题<br>定制 Pigsty 离线安装包</p>
401-
<div class="service-price">¥ 200 / 问题</div>
401+
<div class="service-price">¥ 300 / 问题</div>
402402
</div>
403403

404404
<div class="service-card" data-reveal>
@@ -407,7 +407,7 @@ <h3 class="service-title">挂专家号</h3>
407407
</div>
408408
<h3 class="service-title">专家咨询</h3>
409409
<p class="service-desc">深入探讨某一个主题<br>分享行业顶级经验与认知</p>
410-
<div class="service-price">¥ 3,000 / 实例</div>
410+
<div class="service-price">¥ 3,000 / 案例</div>
411411
</div>
412412

413413
<div class="service-card" data-reveal>
@@ -416,7 +416,7 @@ <h3 class="service-title">专家咨询</h3>
416416
</div>
417417
<h3 class="service-title">紧急救援</h3>
418418
<p class="service-desc">架构升级,数据迁移<br>紧急故障响应,数据恢复</p>
419-
<div class="service-price">¥ 30,000 / 人·天</div>
419+
<div class="service-price">¥ 30,000 / 人天·案例</div>
420420
</div>
421421

422422
<div class="service-card" data-reveal>

layouts/_partials/head-css.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{{ $scssMain := "scss/main.scss" -}}
2+
{{ $css := resources.Get $scssMain
3+
| toCSS (dict "enableSourceMap" (not hugo.IsProduction)) -}}
4+
5+
{{/* NOTE: we only apply `postCSS` in production or for RTL languages. This
6+
makes it snappier to develop in Chrome, but it may look sub-optimal in other
7+
browsers. */ -}}
8+
9+
{{ if eq .Site.Language.Direction "rtl" -}}
10+
{{ $css = $css
11+
| postCSS (dict "use" "autoprefixer rtlcss" "noMap" true)
12+
| resources.Copy (replace $scssMain "." ".rtl.") -}}
13+
{{ else if hugo.IsProduction -}}
14+
{{ $css = $css | postCSS -}}
15+
{{ end -}}
16+
17+
{{ if hugo.IsProduction -}}
18+
{{ $css = $css | minify | fingerprint -}}
19+
<link rel="preload" href="{{ $css.RelPermalink }}" as="style" integrity="{{ $css.Data.Integrity }}" crossorigin="anonymous">
20+
{{ end -}}
21+
22+
{{ with $css -}}
23+
<link href="{{ .RelPermalink }}" rel="stylesheet"
24+
{{- with .Data.Integrity }} integrity="{{ . }}" crossorigin="anonymous"{{ end -}}
25+
>
26+
{{ else -}}
27+
{{ errorf "Resource not found or error building CSS: %s" $scssMain -}}
28+
{{ end -}}
29+
30+
{{- /**/ -}}

layouts/_partials/head.html

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
{{/* cSpell:ignore docsearch opengraph outputformat */ -}}
2+
<meta charset="utf-8">
3+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
4+
5+
{{ $darkMode := partialCached "dark-mode-config.html" "dark-mode-global" -}}
6+
{{ if $darkMode.enable -}}
7+
{{/* Browser hints before CSS loads */ -}}
8+
<meta name="color-scheme" content="light dark">
9+
<meta name="theme-color" media="(prefers-color-scheme: light)" content="#ffffff">
10+
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#000000">
11+
12+
{{/* Styles to set canvas colors and avoid transitions */ -}}
13+
<style>
14+
{{/* Set system colors as default */ -}}
15+
html { background: Canvas; color: CanvasText; }
16+
{{/* Define reasonable dark defaults */ -}}
17+
@media (prefers-color-scheme: dark) {
18+
html { background: #0b0d12; color: #e6e6e6; }
19+
}
20+
{{/* Avoid transitions until theme CSS is loaded */ -}}
21+
html[data-theme-init] * { transition: none !important; }
22+
</style>
23+
24+
{{/* Set theme attribute before CSS loads to prevent flash */ -}}
25+
<script>
26+
(function() {
27+
const themeKey = 'td-color-theme';
28+
const storedTheme = localStorage.getItem(themeKey);
29+
let theme = storedTheme || (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
30+
31+
if (theme === 'auto') {
32+
theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
33+
}
34+
35+
document.documentElement.setAttribute('data-bs-theme', theme);
36+
})();
37+
</script>
38+
{{ end -}}
39+
40+
{{ range .AlternativeOutputFormats -}}
41+
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}">
42+
{{ end -}}
43+
44+
{{ $outputFormat := partial "outputformat.html" . -}}
45+
{{ if and hugo.IsProduction (ne $outputFormat "print") (ne .Site.Language.Lang "xx") -}}
46+
<meta name="robots" content="index, follow">
47+
{{ else -}}
48+
<meta name="robots" content="noindex, nofollow">
49+
{{ end -}}
50+
51+
{{ partialCached "favicons.html" . }}
52+
<title>
53+
{{- if .IsHome -}}
54+
{{ .Site.Title -}}
55+
{{ else -}}
56+
{{ with .Title }}{{ . }} | {{ end -}}
57+
{{ .Site.Title -}}
58+
{{ end -}}
59+
</title>
60+
<meta name="description" content="{{ partial "page-description.html" . }}">
61+
{{ partial "opengraph.html" . -}}
62+
{{ partial "schema.html" . -}}
63+
{{ partial "twitter_cards.html" . -}}
64+
{{ partialCached "head-css.html" . "head-css-cache-key" -}}
65+
<script src="{{ "vendor/jquery/jquery.min.js" | relURL }}"></script>
66+
{{ if .Site.Params.offlineSearch -}}
67+
<script defer src="{{ "vendor/lunr/lunr.min.js" | relURL }}"></script>
68+
{{ end -}}
69+
70+
{{ if .Site.Params.prism_syntax_highlighting -}}
71+
<link rel="stylesheet" href="{{ "css/prism.css" | relURL }}"/>
72+
{{ end -}}
73+
74+
{{ template "algolia/head" . -}}
75+
76+
{{ partial "hooks/head-end.html" . -}}
77+
78+
{{/* To comply with GDPR, cookie consent scripts places in head-end must execute before Google Analytics is enabled */ -}}
79+
{{ if hugo.IsProduction -}}
80+
{{ partial "google_analytics.html" . -}}
81+
{{ end -}}
82+
83+
{{ define "algolia/head" -}}
84+
85+
{{ if and .Site.Params.search (isset .Site.Params.search "algolia") -}}
86+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@docsearch/css@3.8.2"
87+
integrity="sha512-l7pkV1dOURFyHCeH8I4fK9lCkQKuqhlsTCqRl3zktifDlB8oTUJ+mJPgYkK9kHpUut8j1iPquTv32t6hvTPv3g=="
88+
crossorigin="anonymous" />
89+
{{ end -}}
90+
91+
{{ if ne .Site.Params.algolia_docsearch nil -}}
92+
{{ warnf `Config 'params.algolia_docsearch' is deprecated: use 'params.search.algolia'
93+
For details, see https://www.docsy.dev/docs/content/search/#algolia-docsearch.` -}}
94+
{{ end -}}
95+
96+
{{ end -}}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{{/* Mermaid - use a vendored static file instead of Docsy's CDN fetch. */ -}}
2+
{{ $mermaidPath := "vendor/mermaid/mermaid.min.js" -}}
3+
{{ if not (fileExists (printf "static/%s" $mermaidPath)) -}}
4+
{{ errorf "Local Mermaid script not found: static/%s" $mermaidPath -}}
5+
{{ end -}}
6+
7+
<script src="{{ $mermaidPath | relURL }}"></script>
8+
<script>
9+
(function ($, mermaid) {
10+
if (!mermaid) {
11+
console.error('Mermaid is not available from {{ $mermaidPath }}');
12+
return;
13+
}
14+
15+
if ($('.mermaid').length === 0) {
16+
mermaid.initialize({ startOnLoad: false });
17+
return;
18+
}
19+
20+
var params = {{ with .Site.Params.mermaid }}{{ . | jsonify | safeJS }}{{ else }}{}{{- end }};
21+
22+
// Site params are stored with lowercase keys; lookup correct casing
23+
// from Mermaid default config.
24+
var norm = function (defaultConfig, params) {
25+
var result = {};
26+
for (const key in defaultConfig) {
27+
const keyLower = key.toLowerCase();
28+
if (defaultConfig.hasOwnProperty(key) && params.hasOwnProperty(keyLower)) {
29+
if (typeof defaultConfig[key] === "object") {
30+
result[key] = norm(defaultConfig[key], params[keyLower]);
31+
} else {
32+
result[key] = params[keyLower];
33+
}
34+
}
35+
}
36+
return result;
37+
};
38+
39+
var defaultConfig = (mermaid.mermaidAPI && mermaid.mermaidAPI.defaultConfig) || {};
40+
var settings = norm(defaultConfig, params);
41+
settings.startOnLoad = true;
42+
if ($('html[data-bs-theme="dark"]').length) {
43+
settings.theme = 'dark';
44+
}
45+
mermaid.initialize(settings);
46+
47+
// Handle light/dark mode theme changes.
48+
const lightDarkModeThemeChangeHandler = function (mutationsList, observer) {
49+
for (const mutation of mutationsList) {
50+
if (mutation.type === 'attributes' && mutation.attributeName === 'data-bs-theme') {
51+
// Mermaid doesn't currently support reinitialization, see
52+
// https://github.com/mermaid-js/mermaid/issues/1945. Until then,
53+
// just reload the page.
54+
location.reload();
55+
}
56+
}
57+
};
58+
59+
const observer = new MutationObserver(lightDarkModeThemeChangeHandler);
60+
observer.observe(document.documentElement, {
61+
attributes: true,
62+
attributeFilter: ['data-bs-theme']
63+
});
64+
})(jQuery, window.mermaid);
65+
</script>

layouts/baseof.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!doctype html>
2+
<html itemscope itemtype="http://schema.org/WebPage"
3+
{{- with .Site.Language.Direction }} dir="{{ . }}" {{- end -}}
4+
{{ with .Site.Language.Lang }} lang="{{ . }}" {{- end }} {{/**/ -}}
5+
class="no-js"
6+
{{- $darkMode := partialCached "dark-mode-config.html" "dark-mode-global" -}}
7+
{{- if $darkMode.enable }} data-theme-init{{ end }}>
8+
<head>
9+
{{ partial "head.html" . }}
10+
</head>
11+
<body class="td-{{ .Kind }}{{ with .Page.Params.body_class }} {{ . }}{{ end }}">
12+
<header>
13+
{{ partial "navbar.html" . }}
14+
</header>
15+
<div class="container-fluid td-default td-outer">
16+
<main role="main" class="td-main">
17+
{{ block "main" . }}{{ end }}
18+
</main>
19+
{{ partial "footer.html" . }}
20+
</div>
21+
{{ partialCached "scripts.html" . }}
22+
</body>
23+
</html>

layouts/blog/baseof.html

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!doctype html>
2+
<html itemscope itemtype="http://schema.org/WebPage"
3+
{{- with .Site.Language.Direction }} dir="{{ . }}" {{- end -}}
4+
{{ with .Site.Language.Lang }} lang="{{ . }}" {{- end }} {{/**/ -}}
5+
class="no-js"
6+
{{- $darkMode := partialCached "dark-mode-config.html" "dark-mode-global" -}}
7+
{{- if $darkMode.enable }} data-theme-init{{ end }}>
8+
<head>
9+
{{ partial "head.html" . }}
10+
</head>
11+
<body class="td-{{ .Kind }} td-blog {{- with .Page.Params.body_class }} {{ . }}{{ end }}">
12+
<header>
13+
{{ partial "navbar.html" . }}
14+
</header>
15+
<div class="container-fluid td-outer">
16+
<div class="td-main" {{- partialCached "td/scrollspy-attr.txt" . .Section | safeHTMLAttr }}>
17+
<div class="row flex-xl-nowrap">
18+
<aside class="col-12 col-md-3 col-xl-2 td-sidebar d-print-none">
19+
{{ partial "sidebar.html" . }}
20+
</aside>
21+
<aside class="td-sidebar-toc">
22+
{{ partial "page-meta-links.html" . }}
23+
{{ partial "toc.html" . }}
24+
{{ partial "taxonomy_terms_clouds.html" . }}
25+
</aside>
26+
<main class="col-12 col-md-9 col-xl-8 ps-md-5 pe-md-4" role="main">
27+
{{ with .CurrentSection.OutputFormats.Get "rss" -}}
28+
<a class="td-rss-button" title="RSS" href="{{ .RelPermalink | safeURL }}" target="_blank" rel="noopener">
29+
<i class="fa-solid fa-rss" aria-hidden="true"></i>
30+
</a>
31+
{{ end -}}
32+
{{ if not (.Param "ui.breadcrumb_disable") -}}
33+
{{ partial "breadcrumb.html" . -}}
34+
{{ end -}}
35+
{{ block "main" . }}{{ end }}
36+
</main>
37+
</div>
38+
</div>
39+
{{ partial "footer.html" . }}
40+
</div>
41+
{{ partial "scripts.html" . }}
42+
</body>
43+
</html>

layouts/blog/baseof.print.html

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!doctype html>
2+
<html itemscope itemtype="http://schema.org/WebPage"
3+
{{- with .Site.Language.Direction }} dir="{{ . }}" {{- end -}}
4+
{{ with .Site.Language.Lang }} lang="{{ . }}" {{- end }} {{/**/ -}}
5+
class="no-js"
6+
{{- $darkMode := partialCached "dark-mode-config.html" "dark-mode-global" -}}
7+
{{- if $darkMode.enable }} data-theme-init{{ end }}>
8+
<head>
9+
{{ partial "head.html" . }}
10+
</head>
11+
<body class="td-{{ .Kind }} td-blog">
12+
<header>
13+
{{ partial "navbar.html" . }}
14+
</header>
15+
<div class="container-fluid td-outer">
16+
<div class="td-main">
17+
<div class="row flex-xl-nowrap">
18+
<div class="col-12 col-md-3 col-xl-2 td-sidebar d-print-none">
19+
</div>
20+
<div class="d-none d-xl-block col-xl-2 td-toc d-print-none">
21+
</div>
22+
<main class="col-12 col-md-9 col-xl-8 ps-md-5 pe-md-4" role="main">
23+
{{ block "main" . }}{{ end }}
24+
</main>
25+
</div>
26+
</div>
27+
{{ partial "footer.html" . }}
28+
</div>
29+
{{ partial "scripts.html" . }}
30+
</body>
31+
</html>

0 commit comments

Comments
 (0)