Skip to content

Commit bff71ed

Browse files
committed
refactor: ⚰️ remove unused configs
1 parent 3b30baf commit bff71ed

File tree

2 files changed

+6
-61
lines changed

2 files changed

+6
-61
lines changed

astro.config.mjs

Lines changed: 5 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,21 @@
11
import { defineConfig } from "astro/config";
22
import starlight from "@astrojs/starlight";
3-
import partytown from "@astrojs/partytown";
4-
import preact from "@astrojs/preact";
53
import { autoImportComponents } from "@serverless-cd/goat-ui/src/utils";
64
import tailwind from "@astrojs/tailwind";
75
import icon from "astro-icon";
8-
// import compress from 'astro-compress';
9-
import rehypeExternalLinks from "rehype-external-links";
10-
11-
import {
12-
addPrefixImageLink,
13-
remarkRemoveMdLinks,
14-
remarkRemovePlainLanguageCode,
15-
remarkRemoveRepeatHeader,
16-
setLinkReferrer,
17-
} from "./src/utils/frontmatter.mjs";
18-
import { ANALYTICS, SIDEBAR, SITE } from "./src/utils/config.ts";
19-
import { starlightAsides } from "./node_modules/@astrojs/starlight/integrations/asides";
6+
import { SIDEBAR, SITE } from "./src/utils/config.ts";
207
import topLevelAwait from "vite-plugin-top-level-await";
218
import starlightUtils from "@lorenzo_lewis/starlight-utils";
229

23-
const whenExternalScripts = (items = []) =>
24-
ANALYTICS.vendors.googleAnalytics.id &&
25-
ANALYTICS.vendors.googleAnalytics.partytown
26-
? Array.isArray(items)
27-
? items.map((item) => item())
28-
: [items()]
29-
: [];
30-
3110
// https://astro.build/config
3211
export default defineConfig({
3312
site: process.env.DEPLOY_SITE || SITE.site,
3413
base: SITE.base,
14+
//设置处理后斜杠的策略
3515
trailingSlash: SITE.trailingSlash,
3616
image: {
3717
domain: ["img.alicdn"],
3818
},
39-
4019
integrations: [
4120
autoImportComponents(),
4221
starlight({
@@ -46,7 +25,9 @@ export default defineConfig({
4625
src: "./src/assets/logo.png",
4726
replacesTitle: true,
4827
},
28+
//自定义组件
4929
components: {
30+
//重写主题提供组件,实现默认深色主题
5031
ThemeProvider: "./src/components/ThemeProvider.astro",
5132
},
5233
disable404Route: true,
@@ -59,6 +40,7 @@ export default defineConfig({
5940
editLink: {
6041
baseUrl: SITE.websiteGithubUrl,
6142
},
43+
//多路侧边栏设置
6244
sidebar: SIDEBAR,
6345
plugins: [
6446
starlightUtils({
@@ -74,32 +56,7 @@ export default defineConfig({
7456
"ant-design": ["github-filled"],
7557
basil: ["document-outline"],
7658
}),
77-
preact({ compat: true }),
78-
...whenExternalScripts(() =>
79-
partytown({
80-
config: { forward: ["dataLayer.push"] },
81-
}),
82-
),
8359
],
84-
markdown: {
85-
rehypePlugins: [
86-
// 在这里添加 rehype-external-links 插件配置
87-
[
88-
rehypeExternalLinks,
89-
{
90-
target: "_blank",
91-
},
92-
],
93-
],
94-
remarkPlugins: [
95-
remarkRemoveMdLinks,
96-
remarkRemovePlainLanguageCode,
97-
remarkRemoveRepeatHeader,
98-
addPrefixImageLink,
99-
starlightAsides,
100-
setLinkReferrer,
101-
],
102-
},
10360
vite: {
10461
build: {
10562
target: "chrome68",

src/config.yaml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,9 @@ site:
44
base: "/"
55
trailingSlash: "ignore"
66
websiteGithubUrl: "https://github.com/spring-cloud-alibaba-group/spring-cloud-alibaba-group.github.io/blob/main"
7-
githubUrl: "https://github.com/alibaba/spring-cloud-alibaba"
7+
githubUrl: "https://github.com/Serverless-Devs/Serverless-Devs"
88
logoUrl: "https://img.alicdn.com/imgextra/i4/O1CN01nAxx821DsAIk5F5uC_!!6000000000271-2-tps-667-370.png"
99

10-
analytics:
11-
vendors:
12-
googleAnalytics:
13-
id: null # or "G-XXXXXXXXXX"
14-
baiduAnalytics:
15-
id:
16-
verification: code-wzq5sw7io3
17-
aesAnalytics:
18-
pid: e7WQkK
19-
clarityAlalytics:
20-
id: l4jzj6wbhh
21-
2210
# Default SEO metadata
2311
metadata:
2412
title:

0 commit comments

Comments
 (0)