hexo-theme-gnix 11.0.0 → 13.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/include/hexo/i18n.js +11 -1
- package/include/hexo/obsidian-callouts.js +210 -0
- package/include/hexo/renderer.js +199 -16
- package/include/hexo/shiki.js +191 -0
- package/include/hexo/sitemap.js +184 -0
- package/languages/en.yml +4 -10
- package/languages/zh-CN.yml +4 -10
- package/layout/common/article.jsx +49 -24
- package/layout/common/article_info.jsx +11 -48
- package/layout/common/footer.jsx +14 -106
- package/layout/common/head.jsx +3 -15
- package/layout/common/navbar.jsx +14 -80
- package/layout/layout.jsx +33 -16
- package/layout/plugin/goatcounter.jsx +25 -0
- package/package.json +7 -14
- package/scripts/index.js +1 -0
- package/source/css/archive.css +3 -5
- package/source/css/callout_blocks.css +41 -21
- package/source/css/default.css +72 -117
- package/source/css/optional/mermaid.css +12 -6
- package/source/css/shiki/shiki.css +5 -4
- package/source/js/components/friends-list.js +271 -0
- package/source/js/components/tab.js +242 -0
- package/source/js/components/x-info-card.js +297 -0
- package/source/js/main.js +23 -119
- package/source/js/mdit/mermaid.js +10 -0
package/layout/common/footer.jsx
CHANGED
|
@@ -2,92 +2,25 @@ const { Component, cacheComponent } = require("../../include/util/common");
|
|
|
2
2
|
|
|
3
3
|
class Footer extends Component {
|
|
4
4
|
render() {
|
|
5
|
-
const {
|
|
5
|
+
const { copyright, showVisitorCounter, visitorCounterTitle, ICPRecord } = this.props;
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
<
|
|
9
|
-
<
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
stroke="var(--lavender)"
|
|
14
|
-
stroke-linecap="square"
|
|
15
|
-
></path>
|
|
16
|
-
</g>
|
|
17
|
-
</pattern>
|
|
18
|
-
<rect width="100%" height="100%" fill="url(#a)"></rect>
|
|
19
|
-
</svg>
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
const footer_brand = (
|
|
23
|
-
<div class="footer-column footer-brand">
|
|
24
|
-
<p class="footer-title">{author || siteTitle}</p>
|
|
25
|
-
<p class="footer-meta">
|
|
26
|
-
<span
|
|
27
|
-
dangerouslySetInnerHTML={{
|
|
28
|
-
__html: `© 2022 - ${siteYear}`,
|
|
29
|
-
}}
|
|
30
|
-
></span>
|
|
31
|
-
Powered by Hexo
|
|
7
|
+
return (
|
|
8
|
+
<footer class="footer">
|
|
9
|
+
<div class="footer-brand">
|
|
10
|
+
<p class="footer-credit">
|
|
11
|
+
2022–PRESENT <span class="footer-author">© GnixAij Oag</span> CC BY-NC-SA 4.0
|
|
12
|
+
</p>
|
|
32
13
|
{showVisitorCounter ? (
|
|
33
|
-
|
|
34
|
-
<br />
|
|
14
|
+
<p class="footer-meta">
|
|
35
15
|
<span id="busuanzi_container_site_uv" dangerouslySetInnerHTML={{ __html: visitorCounterTitle }}></span>
|
|
36
|
-
|
|
16
|
+
</p>
|
|
37
17
|
) : null}
|
|
38
18
|
{ICPRecord ? (
|
|
39
|
-
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
</>
|
|
19
|
+
<p class="footer-meta">
|
|
20
|
+
<a href="https://beian.miit.gov.cn/" class="footer-icp" target="_blank" rel="noopener" dangerouslySetInnerHTML={{ __html: ICPRecord }}></a>
|
|
21
|
+
</p>
|
|
43
22
|
) : null}
|
|
44
|
-
|
|
45
|
-
{copyright ? <p class="footer-meta" dangerouslySetInnerHTML={{ __html: copyright }}></p> : null}
|
|
46
|
-
</div>
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
const footer_social = (
|
|
50
|
-
<div class="footer-column footer-social">
|
|
51
|
-
<p class="footer-heading">Social Media</p>
|
|
52
|
-
<div class="footer-links">
|
|
53
|
-
{Object.keys(links).length
|
|
54
|
-
? Object.keys(links).map((name) => {
|
|
55
|
-
const link = links[name];
|
|
56
|
-
return (
|
|
57
|
-
<a class="footer-link" target="_blank" rel="noopener" title={name} href={link.url}>
|
|
58
|
-
{link.icon ? <iconify-icon icon={link.icon}></iconify-icon> : name}
|
|
59
|
-
</a>
|
|
60
|
-
);
|
|
61
|
-
})
|
|
62
|
-
: null}
|
|
63
|
-
</div>
|
|
64
|
-
</div>
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
const footer_subdomains = (
|
|
68
|
-
<div class="footer-column footer-subdomains">
|
|
69
|
-
<p class="footer-heading">Quick Links</p>
|
|
70
|
-
<div class="footer-links">
|
|
71
|
-
{Object.keys(subdomains).length
|
|
72
|
-
? Object.keys(subdomains).map((name) => {
|
|
73
|
-
const link = subdomains[name];
|
|
74
|
-
return (
|
|
75
|
-
<a class="footer-link" target="_self" rel="noopener" title={name} href={link.url}>
|
|
76
|
-
{name}
|
|
77
|
-
</a>
|
|
78
|
-
);
|
|
79
|
-
})
|
|
80
|
-
: null}
|
|
81
|
-
</div>
|
|
82
|
-
</div>
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<footer class="footer">
|
|
87
|
-
<div class="footer-grid">
|
|
88
|
-
{footer_brand}
|
|
89
|
-
{footer_subdomains}
|
|
90
|
-
{footer_social}
|
|
23
|
+
{copyright ? <p class="footer-meta" dangerouslySetInnerHTML={{ __html: copyright }}></p> : null}
|
|
91
24
|
</div>
|
|
92
25
|
</footer>
|
|
93
26
|
);
|
|
@@ -96,33 +29,10 @@ class Footer extends Component {
|
|
|
96
29
|
|
|
97
30
|
module.exports = cacheComponent(Footer, "common.footer", (props) => {
|
|
98
31
|
const { config, helper, page, site } = props;
|
|
99
|
-
const {
|
|
32
|
+
const { _p, date } = helper;
|
|
100
33
|
const { title, author, footer, plugins } = config;
|
|
101
34
|
const langKey = helper.language_key(page);
|
|
102
35
|
|
|
103
|
-
const links = {};
|
|
104
|
-
if (footer?.links) {
|
|
105
|
-
Object.keys(footer.links).forEach((name) => {
|
|
106
|
-
const link = footer.links[name];
|
|
107
|
-
links[name] = {
|
|
108
|
-
url: url_for(typeof link === "string" ? link : link.url),
|
|
109
|
-
icon: link.icon,
|
|
110
|
-
};
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const subdomains = {};
|
|
115
|
-
if (footer?.subdomains) {
|
|
116
|
-
Object.keys(footer.subdomains).forEach((name) => {
|
|
117
|
-
const link = footer.subdomains[name];
|
|
118
|
-
const targetUrl = typeof link === "string" ? link : link.url;
|
|
119
|
-
subdomains[name] = {
|
|
120
|
-
url: helper.localized_url_for(targetUrl, langKey),
|
|
121
|
-
};
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// Build archives grouped by year from site posts
|
|
126
36
|
let archives = [];
|
|
127
37
|
if (site?.posts?.length) {
|
|
128
38
|
const archiveDir = config.archive_dir || "archives";
|
|
@@ -148,8 +58,6 @@ module.exports = cacheComponent(Footer, "common.footer", (props) => {
|
|
|
148
58
|
siteTitle: title,
|
|
149
59
|
siteYear: date(new Date(), "YYYY"),
|
|
150
60
|
author,
|
|
151
|
-
links,
|
|
152
|
-
subdomains,
|
|
153
61
|
archives,
|
|
154
62
|
copyright: footer?.copyright ?? "",
|
|
155
63
|
showVisitorCounter: plugins && plugins.busuanzi === true,
|
package/layout/common/head.jsx
CHANGED
|
@@ -5,7 +5,7 @@ const StructuredData = require("../../layout/misc/structured_data");
|
|
|
5
5
|
const Plugins = require("./plugins");
|
|
6
6
|
const { getArticleFontInitScript } = require("../../include/util/article_font");
|
|
7
7
|
const { getThemeInitScript } = require("../../include/util/theme");
|
|
8
|
-
const { getDefaultLanguageKey,
|
|
8
|
+
const { getDefaultLanguageKey, getLanguage, getPageLanguageKey, getPageLocale, isI18nEnabled, normalizeLocale } = require("../../include/util/i18n");
|
|
9
9
|
const fs = require("node:fs");
|
|
10
10
|
const path = require("node:path");
|
|
11
11
|
|
|
@@ -82,27 +82,15 @@ function addExplicitAlternates(links, alternates, helper, config) {
|
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
function collectDocuments(site) {
|
|
86
|
-
return [...toArray(site?.posts), ...toArray(site?.pages)];
|
|
87
|
-
}
|
|
88
|
-
|
|
89
85
|
function getHreflangLinks(site, page, config, helper) {
|
|
90
86
|
if (!isI18nEnabled(config)) return [];
|
|
91
87
|
|
|
92
88
|
const links = new Map();
|
|
93
|
-
const pageKey = getI18nKey(page);
|
|
94
89
|
const langKey = getPageLanguageKey(page, config);
|
|
95
90
|
const locale = getPageLocale(page, config);
|
|
96
91
|
|
|
97
92
|
addAlternateLink(links, locale, page.permalink || page.path, helper, config);
|
|
98
|
-
addExplicitAlternates(links, page.i18n
|
|
99
|
-
|
|
100
|
-
if (pageKey) {
|
|
101
|
-
collectDocuments(site).forEach((item) => {
|
|
102
|
-
if (!item || getI18nKey(item) !== pageKey) return;
|
|
103
|
-
addAlternateLink(links, getPageLocale(item, config), item.permalink || item.path, helper, config);
|
|
104
|
-
});
|
|
105
|
-
}
|
|
93
|
+
addExplicitAlternates(links, page.i18n, helper, config);
|
|
106
94
|
|
|
107
95
|
if (links.size > 1 && !links.has("x-default")) {
|
|
108
96
|
const defaultLanguage = getLanguage(config, getDefaultLanguageKey(config));
|
|
@@ -174,10 +162,10 @@ module.exports = class extends Component {
|
|
|
174
162
|
|
|
175
163
|
return (
|
|
176
164
|
<head>
|
|
165
|
+
<meta charset="utf-8" />
|
|
177
166
|
<script dangerouslySetInnerHTML={{ __html: themeInitScript }}></script>
|
|
178
167
|
<script dangerouslySetInnerHTML={{ __html: articleFontUtilsScript }}></script>
|
|
179
168
|
<script dangerouslySetInnerHTML={{ __html: articleFontInitScript }}></script>
|
|
180
|
-
<meta charset="utf-8" />
|
|
181
169
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
182
170
|
{noIndex ? <meta name="robots" content="noindex" /> : null}
|
|
183
171
|
{meta?.length ? <MetaTags meta={meta} /> : null}
|
package/layout/common/navbar.jsx
CHANGED
|
@@ -1,25 +1,5 @@
|
|
|
1
1
|
const { Component, Fragment, cacheComponent } = require("../../include/util/common");
|
|
2
|
-
const {
|
|
3
|
-
|
|
4
|
-
function isActiveMenuLink(menuUrl, pageUrl) {
|
|
5
|
-
const menuPath = sanitizeLink(menuUrl);
|
|
6
|
-
const pagePath = sanitizeLink(pageUrl);
|
|
7
|
-
if (menuPath === pagePath) return true;
|
|
8
|
-
if (!menuPath) return false;
|
|
9
|
-
return pagePath.startsWith(`${menuPath}/`);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function sanitizeLink(url) {
|
|
13
|
-
let paths = url
|
|
14
|
-
.replace(/(^\w+:|^)\/\//, "")
|
|
15
|
-
.split("#")[0]
|
|
16
|
-
.split("/")
|
|
17
|
-
.filter((p) => p.trim() !== "");
|
|
18
|
-
if (paths.length > 0 && paths[paths.length - 1].trim() === "index.html") {
|
|
19
|
-
paths = paths.slice(0, paths.length - 1);
|
|
20
|
-
}
|
|
21
|
-
return paths.join("/");
|
|
22
|
-
}
|
|
2
|
+
const { getLanguage, getLanguageKeys, getPageLanguageKey, isExternalUrl, isI18nEnabled } = require("../../include/util/i18n");
|
|
23
3
|
|
|
24
4
|
const renderLinkIcon = (link) => {
|
|
25
5
|
if (!link.icon) return null;
|
|
@@ -36,16 +16,6 @@ const renderLinkIcon = (link) => {
|
|
|
36
16
|
return <iconify-icon icon={link.icon}></iconify-icon>;
|
|
37
17
|
};
|
|
38
18
|
|
|
39
|
-
function collectDocuments(site) {
|
|
40
|
-
return [...toArray(site?.posts), ...toArray(site?.pages)];
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function getDocumentUrl(helper, document) {
|
|
44
|
-
const href = document?.path || document?.permalink;
|
|
45
|
-
if (!href) return null;
|
|
46
|
-
return isExternalUrl(href) ? href : helper.url_for(href);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
19
|
function getTargetLanguageKey(config, currentLanguageKey) {
|
|
50
20
|
const languageKeys = getLanguageKeys(config);
|
|
51
21
|
if (currentLanguageKey === "en" && languageKeys.includes("cn")) return "cn";
|
|
@@ -71,27 +41,24 @@ function getLanguageSwitch(site, page, config, helper) {
|
|
|
71
41
|
if (!targetLanguage || targetLanguageKey === currentLanguageKey) return null;
|
|
72
42
|
const targetLanguageName = getTargetLanguageDisplayName(currentLanguageKey, targetLanguageKey, targetLanguage);
|
|
73
43
|
|
|
74
|
-
const pageKey = getI18nKey(page);
|
|
75
44
|
let url = null;
|
|
76
|
-
|
|
77
|
-
if (
|
|
78
|
-
const
|
|
79
|
-
|
|
45
|
+
const pageI18n = page.i18n;
|
|
46
|
+
if (pageI18n && typeof pageI18n === "object" && targetLanguageKey) {
|
|
47
|
+
const altUrl = pageI18n[targetLanguageKey] || (targetLanguage ? pageI18n[targetLanguage.locale] : null);
|
|
48
|
+
if (altUrl) {
|
|
49
|
+
url = isExternalUrl(altUrl) ? altUrl : helper.url_for(altUrl);
|
|
50
|
+
}
|
|
80
51
|
}
|
|
81
52
|
|
|
82
53
|
const isDocumentPage = ["page", "post"].includes(page?.layout);
|
|
83
54
|
const title = helper.__("navbar.language_switch", targetLanguageName);
|
|
84
|
-
const homeUrl = helper.localized_url_for("/", currentLanguageKey);
|
|
85
|
-
const unavailableTitle = helper.__("navbar.language_unavailable_title");
|
|
86
55
|
const unavailableMessage = helper.__("navbar.language_unavailable", targetLanguageName);
|
|
87
|
-
const stayLabel = helper.__("navbar.language_stay");
|
|
88
|
-
const homeLabel = helper.__("navbar.language_home");
|
|
89
|
-
const closeLabel = helper.__("navbar.language_close");
|
|
90
56
|
|
|
91
57
|
const mode = !url && isDocumentPage ? "missing" : "link";
|
|
92
58
|
|
|
93
59
|
if (!url && mode === "link") {
|
|
94
|
-
|
|
60
|
+
const targetPath = page?.current > 1 ? "/" : (page?.path || "/");
|
|
61
|
+
url = helper.localized_url_for(targetPath, targetLanguageKey);
|
|
95
62
|
}
|
|
96
63
|
|
|
97
64
|
return {
|
|
@@ -100,12 +67,7 @@ function getLanguageSwitch(site, page, config, helper) {
|
|
|
100
67
|
locale: targetLanguage.locale,
|
|
101
68
|
label: targetLanguageName,
|
|
102
69
|
title,
|
|
103
|
-
homeUrl,
|
|
104
|
-
unavailableTitle,
|
|
105
70
|
unavailableMessage,
|
|
106
|
-
stayLabel,
|
|
107
|
-
homeLabel,
|
|
108
|
-
closeLabel,
|
|
109
71
|
};
|
|
110
72
|
}
|
|
111
73
|
|
|
@@ -127,7 +89,7 @@ class Navbar extends Component {
|
|
|
127
89
|
<Fragment>
|
|
128
90
|
<nav class="navbar navbar-main">
|
|
129
91
|
<div class="navbar-container" onclick="toggleNav(event)">
|
|
130
|
-
<a href={siteUrl} style={"font-family: homemade-apple; color: var(--text); display: flex; align-items: center; padding: 0 1em;"}>
|
|
92
|
+
<a id="navbar-logo-link" href={siteUrl} style={"font-family: homemade-apple; color: var(--text); display: flex; align-items: center; padding: 0 1em;"}>
|
|
131
93
|
GnixAij
|
|
132
94
|
</a>
|
|
133
95
|
<div class="navbar-menu">
|
|
@@ -135,9 +97,8 @@ class Navbar extends Component {
|
|
|
135
97
|
<div class="navbar-start">
|
|
136
98
|
{Object.keys(menu).map((name) => {
|
|
137
99
|
const item = menu[name];
|
|
138
|
-
const navbar_item_class = `navbar-item ${item.active ? "is-active" : ""}`;
|
|
139
100
|
return (
|
|
140
|
-
<a class=
|
|
101
|
+
<a class="navbar-item" href={item.url} data-navbar-menu={name}>
|
|
141
102
|
{name}
|
|
142
103
|
</a>
|
|
143
104
|
);
|
|
@@ -162,7 +123,7 @@ class Navbar extends Component {
|
|
|
162
123
|
<a id="language-switch-link" class="navbar-item" href={languageSwitch.url || '#'} title={languageSwitch.title} aria-label={languageSwitch.title} lang={languageSwitch.locale} hreflang={languageSwitch.locale} style={languageSwitch.mode === 'link' ? '' : 'display:none'}>
|
|
163
124
|
{languageIcon}
|
|
164
125
|
</a>
|
|
165
|
-
<button id="language-switch-button" type="button" class="navbar-item" title={languageSwitch.title} aria-label={languageSwitch.title} lang={languageSwitch.locale}
|
|
126
|
+
<button id="language-switch-button" type="button" class="navbar-item" title={languageSwitch.title} aria-label={languageSwitch.title} lang={languageSwitch.locale} data-toast-message={languageSwitch.unavailableMessage} onclick="window.showSiteToast?.(this.dataset.toastMessage); return false;" style={languageSwitch.mode === 'missing' ? '' : 'display:none'}>
|
|
166
127
|
{languageIcon}
|
|
167
128
|
</button>
|
|
168
129
|
</Fragment>
|
|
@@ -192,31 +153,6 @@ class Navbar extends Component {
|
|
|
192
153
|
</button>
|
|
193
154
|
</div>
|
|
194
155
|
</nav>
|
|
195
|
-
{languageSwitch ? (
|
|
196
|
-
<div id="language-switch-popover" class="article-popover language-switch-popover" popover="auto" tabindex="-1">
|
|
197
|
-
<div class="article-popover-header">
|
|
198
|
-
<h3>{languageSwitch.unavailableTitle}</h3>
|
|
199
|
-
<button type="button" class="article-popover-close" popovertarget="language-switch-popover" popovertargetaction="hide" aria-label={languageSwitch.closeLabel}>
|
|
200
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" role="img" aria-label={languageSwitch.closeLabel}>
|
|
201
|
-
<title>{languageSwitch.closeLabel}</title>
|
|
202
|
-
<path d="M18 6 6 18" />
|
|
203
|
-
<path d="m6 6 12 12" />
|
|
204
|
-
</svg>
|
|
205
|
-
</button>
|
|
206
|
-
</div>
|
|
207
|
-
<div class="article-popover-body language-switch-popover-body">
|
|
208
|
-
<p>{languageSwitch.unavailableMessage}</p>
|
|
209
|
-
<div class="language-switch-popover-actions">
|
|
210
|
-
<button type="button" class="language-switch-popover-action" popovertarget="language-switch-popover" popovertargetaction="hide">
|
|
211
|
-
{languageSwitch.stayLabel}
|
|
212
|
-
</button>
|
|
213
|
-
<a id="language-switch-home-link" class="language-switch-popover-action is-primary" href={languageSwitch.homeUrl} onclick="document.getElementById('language-switch-popover')?.hidePopover()">
|
|
214
|
-
{languageSwitch.homeLabel}
|
|
215
|
-
</a>
|
|
216
|
-
</div>
|
|
217
|
-
</div>
|
|
218
|
-
</div>
|
|
219
|
-
) : null}
|
|
220
156
|
</Fragment>
|
|
221
157
|
);
|
|
222
158
|
}
|
|
@@ -233,11 +169,9 @@ module.exports = cacheComponent(Navbar, "common.navbar", (props) => {
|
|
|
233
169
|
|
|
234
170
|
const menu = {};
|
|
235
171
|
if (navbar?.menu) {
|
|
236
|
-
const pageUrl = typeof page.path !== "undefined" ? url_for(page.path) : "";
|
|
237
172
|
Object.keys(navbar.menu).forEach((name) => {
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
menu[name] = { url, active };
|
|
173
|
+
const rawValue = navbar.menu[name];
|
|
174
|
+
menu[name] = { url: helper.localized_url_for(rawValue, langKey) };
|
|
241
175
|
});
|
|
242
176
|
}
|
|
243
177
|
|
package/layout/layout.jsx
CHANGED
|
@@ -9,30 +9,47 @@ const { DEFAULT_SETTINGS: ARTICLE_FONT_DEFAULT_SETTINGS } = require("../include/
|
|
|
9
9
|
|
|
10
10
|
function buildLangSwitchScript(site, page, config, helper) {
|
|
11
11
|
const lswitch = Navbar.getLanguageSwitch(site, page, config, helper);
|
|
12
|
-
if (!lswitch) return "";
|
|
13
12
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
const langKey = helper.language_key(page);
|
|
14
|
+
const menu = {};
|
|
15
|
+
if (config.navbar?.menu) {
|
|
16
|
+
Object.keys(config.navbar.menu).forEach((name) => {
|
|
17
|
+
const rawValue = config.navbar.menu[name];
|
|
18
|
+
menu[name] = { url: helper.localized_url_for(rawValue, langKey) };
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
const siteUrl = helper.localized_url_for("/", langKey);
|
|
22
|
+
|
|
23
|
+
const payload = lswitch
|
|
24
|
+
? JSON.stringify({
|
|
25
|
+
mode: lswitch.mode,
|
|
26
|
+
url: lswitch.url || "",
|
|
27
|
+
locale: lswitch.locale,
|
|
28
|
+
})
|
|
29
|
+
: "null";
|
|
20
30
|
|
|
21
31
|
return `<script data-swup-reload-script>
|
|
22
32
|
(function() {
|
|
23
33
|
var d = ${payload};
|
|
24
34
|
var l = document.getElementById('language-switch-link');
|
|
25
35
|
var b = document.getElementById('language-switch-button');
|
|
26
|
-
if (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (h) h.href = d.homeUrl;
|
|
36
|
+
if (l || b) {
|
|
37
|
+
if (d && d.mode === 'link' && d.url) {
|
|
38
|
+
if (l) { l.href = d.url; l.style.display = ''; l.setAttribute('lang', d.locale); l.setAttribute('hreflang', d.locale); }
|
|
39
|
+
if (b) b.style.display = 'none';
|
|
40
|
+
} else {
|
|
41
|
+
if (l) l.style.display = 'none';
|
|
42
|
+
if (b) { b.style.display = ''; b.setAttribute('lang', d.locale); }
|
|
43
|
+
}
|
|
35
44
|
}
|
|
45
|
+
var menu = ${JSON.stringify(menu)};
|
|
46
|
+
Object.keys(menu).forEach(function(name) {
|
|
47
|
+
var link = document.querySelector('a[data-navbar-menu="' + name + '"]');
|
|
48
|
+
if (!link) return;
|
|
49
|
+
link.href = menu[name].url;
|
|
50
|
+
});
|
|
51
|
+
var logo = document.getElementById('navbar-logo-link');
|
|
52
|
+
if (logo) logo.href = ${JSON.stringify(siteUrl)};
|
|
36
53
|
})();
|
|
37
54
|
<\/script>`;
|
|
38
55
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const { Component, Fragment, cacheComponent } = require("../../include/util/common");
|
|
2
|
+
|
|
3
|
+
class Goatcounter extends Component {
|
|
4
|
+
render() {
|
|
5
|
+
const { url } = this.props;
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<Fragment>
|
|
9
|
+
<script data-goatcounter={url} async src="//gc.zgo.at/count.js"></script>
|
|
10
|
+
</Fragment>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
Goatcounter.Cacheable = cacheComponent(Goatcounter, "plugin.goatcounter", (props) => {
|
|
16
|
+
const { head, plugin } = props;
|
|
17
|
+
if (!head || !plugin.url) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
url: plugin.url,
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
module.exports = Goatcounter;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hexo-theme-gnix",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0",
|
|
4
4
|
"author": "Efterklang <gaojiaxing0220@gmail.com> (https://vluv.space)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Second generation of Hexo theme Icarus, now with Catppuccin flavor and night mode support.",
|
|
@@ -21,8 +21,7 @@
|
|
|
21
21
|
"lint": "biome check --write .",
|
|
22
22
|
"format": "biome format .",
|
|
23
23
|
"check": "biome check",
|
|
24
|
-
"test": "node test/md_generator.test.js"
|
|
25
|
-
"build:swup": "cp src/swup.js source/js/swup.js"
|
|
24
|
+
"test": "node test/md_generator.test.js"
|
|
26
25
|
},
|
|
27
26
|
"files": [
|
|
28
27
|
"include",
|
|
@@ -34,9 +33,6 @@
|
|
|
34
33
|
"README.md"
|
|
35
34
|
],
|
|
36
35
|
"dependencies": {
|
|
37
|
-
"@mdit/plugin-tab": "^0.24.2",
|
|
38
|
-
"@swup/head-plugin": "^2.3.1",
|
|
39
|
-
"@swup/scripts-plugin": "^2.1.0",
|
|
40
36
|
"esbuild": "^0.28.0",
|
|
41
37
|
"feedsmith": "^2.9.4",
|
|
42
38
|
"hexo-pagination": "^4.0.0",
|
|
@@ -47,19 +43,16 @@
|
|
|
47
43
|
"markdown-exit": "^1.0.0-beta.9",
|
|
48
44
|
"markdown-exit-mermaid": "^2.2.3",
|
|
49
45
|
"markdown-exit-ratex": "^0.2.2",
|
|
50
|
-
"
|
|
51
|
-
"
|
|
46
|
+
"@shikijs/colorized-brackets": "^4.0.2",
|
|
47
|
+
"@shikijs/transformers": "^4.0.2",
|
|
48
|
+
"shiki": "^4.0.2",
|
|
52
49
|
"markdown-it-anchor": "^9.2.0",
|
|
53
50
|
"markdown-it-footnote": "^4.0.0",
|
|
54
|
-
"markdown-it-ins": "^4.0.0",
|
|
55
51
|
"markdown-it-mark": "^4.0.0",
|
|
56
|
-
"markdown-it-sub": "^2.0.0",
|
|
57
|
-
"markdown-it-sup": "^2.0.0",
|
|
58
52
|
"markdown-it-task-lists": "^2.1.1",
|
|
59
|
-
"
|
|
53
|
+
"hexo-util": "^4.0.0"
|
|
60
54
|
},
|
|
61
55
|
"peerDependencies": {
|
|
62
|
-
"hexo": "^8.1.
|
|
63
|
-
"hexo-util": "^4.0.0"
|
|
56
|
+
"hexo": "^8.1.2"
|
|
64
57
|
}
|
|
65
58
|
}
|
package/scripts/index.js
CHANGED
|
@@ -2,6 +2,7 @@ require("../include/hexo/i18n")(hexo);
|
|
|
2
2
|
require("../include/hexo/filter")(hexo);
|
|
3
3
|
require("../include/hexo/generator")(hexo);
|
|
4
4
|
require("../include/hexo/feed")(hexo);
|
|
5
|
+
require("../include/hexo/sitemap")(hexo);
|
|
5
6
|
require("../include/hexo/encrypt")(hexo);
|
|
6
7
|
require("../include/hexo/view").init(hexo);
|
|
7
8
|
require("../include/hexo/helper")(hexo);
|
package/source/css/archive.css
CHANGED
|
@@ -167,16 +167,14 @@
|
|
|
167
167
|
|
|
168
168
|
.archive-item::before {
|
|
169
169
|
position: absolute;
|
|
170
|
-
top:
|
|
171
|
-
left: -
|
|
170
|
+
top: 1em;
|
|
171
|
+
left: -1rem;
|
|
172
172
|
width: 0.55rem;
|
|
173
173
|
height: 0.55rem;
|
|
174
174
|
border-radius: 999px;
|
|
175
175
|
background: transparent;
|
|
176
176
|
content: "";
|
|
177
|
-
transition:
|
|
178
|
-
background 140ms ease,
|
|
179
|
-
transform 140ms ease;
|
|
177
|
+
transition: background 500ms ease;
|
|
180
178
|
}
|
|
181
179
|
|
|
182
180
|
.archive-item:hover::before,
|