@xingwangzhe/stalux 1.6.1 → 1.6.2
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/package.json
CHANGED
|
@@ -90,24 +90,38 @@ function getRouteChars(projectRoot: string, subsetId: string): string | null {
|
|
|
90
90
|
return getCategoryContent(contentRoot, catName);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
// ──
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
93
|
+
// ── Home page ───────────────────────────────────────────
|
|
94
|
+
if (subsetId === "home") {
|
|
95
|
+
return getAllConfigContent(contentRoot);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// ── Links page ──────────────────────────────────────────
|
|
99
|
+
if (subsetId === "links") {
|
|
100
|
+
return getAllConfigContent(contentRoot);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// ── Other HTML routes (common) ──
|
|
104
|
+
// The common subset includes UI text from source + config YAML
|
|
105
|
+
if (subsetId === "common") {
|
|
106
|
+
return getAllConfigContent(contentRoot);
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
return null;
|
|
109
110
|
}
|
|
110
111
|
|
|
112
|
+
/** Get all config YAML content */
|
|
113
|
+
function getAllConfigContent(contentRoot: string): string | null {
|
|
114
|
+
const configDir = join(contentRoot, "config");
|
|
115
|
+
if (!existsSync(configDir)) return null;
|
|
116
|
+
const all: string[] = [];
|
|
117
|
+
for (const f of readdirSync(configDir)) {
|
|
118
|
+
if (f.endsWith(".yml") || f.endsWith(".yaml")) {
|
|
119
|
+
all.push(readFileSync(join(configDir, f), "utf-8"));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return all.join("\n") || null;
|
|
123
|
+
}
|
|
124
|
+
|
|
111
125
|
/** Get all post content concatenated (including template/_ files) */
|
|
112
126
|
function getAllPostContent(contentRoot: string): string | null {
|
|
113
127
|
const postsDir = join(contentRoot, "posts");
|
|
@@ -181,6 +181,25 @@ function scanContent(projectRoot: string): ContentFile[] {
|
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
+
// Build virtual routes for config-driven pages (home, links)
|
|
185
|
+
// These pages render text from config YAML files (nav titles, site title, etc.)
|
|
186
|
+
const configDir = join(contentRoot, "config");
|
|
187
|
+
if (existsSync(configDir)) {
|
|
188
|
+
const allConfigContent: string[] = [];
|
|
189
|
+
for (const f of readdirSync(configDir)) {
|
|
190
|
+
if (f.endsWith(".yml") || f.endsWith(".yaml")) {
|
|
191
|
+
allConfigContent.push(readFileSync(join(configDir, f), "utf-8"));
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (allConfigContent.length > 0) {
|
|
195
|
+
const configText = allConfigContent.join("\n");
|
|
196
|
+
// Home page: site title, author, navs, typetexts, social media, footer
|
|
197
|
+
virtualRouteCache.set("home", extractChars(configText));
|
|
198
|
+
// Links page: links config + navs + footer
|
|
199
|
+
virtualRouteCache.set("links", extractChars(configText));
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
184
203
|
// About
|
|
185
204
|
const aboutDir = join(contentRoot, "about");
|
|
186
205
|
if (existsSync(aboutDir)) {
|
package/src/pages/index.astro
CHANGED
|
@@ -15,7 +15,7 @@ import ToArchive from "@components/stalux/archives/toArchive.astro";
|
|
|
15
15
|
import { getSiteData, getAuthorData, getHeadData, getNavsData, getLinksData, getCommentData, getFooterData, getPromoteData, getTypetextsData, getMediaLinksData } from "@utils/config-utils";
|
|
16
16
|
---
|
|
17
17
|
|
|
18
|
-
<Stalux title={siteTitle} description={siteDescription}>
|
|
18
|
+
<Stalux title={siteTitle} description={siteDescription} fontSubsetId="home">
|
|
19
19
|
<div class={styles.homeBody}>
|
|
20
20
|
<h1 class={styles.homeTitle}>{siteTitle}</h1>
|
|
21
21
|
<div class={styles.homeNavs}>
|
package/src/pages/links.astro
CHANGED
|
@@ -13,12 +13,12 @@ const linksTitle = linksConfig.title;
|
|
|
13
13
|
const linksDescription = linksConfig.description;
|
|
14
14
|
---
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
<ListPage
|
|
17
|
+
title={siteTitle}
|
|
18
|
+
description={siteDescription}
|
|
19
|
+
heading={linksTitle}
|
|
20
|
+
subheading={linksDescription}
|
|
21
|
+
fontSubsetId="links"
|
|
22
|
+
>
|
|
23
23
|
<LinkList />
|
|
24
24
|
</ListPage>
|