Skip to content

Commit 8efbd7e

Browse files
Hazel0928heimanba
andauthoredMay 13, 2024··
Develop astro sca (#179)
* fix: wuyi markdown * fix: wuyi fix * fix: wuyi fix * update By Robot2024-05-13 10:47:29 * update By Robot2024-05-13 11:02:40 * update By Robot2024-05-13 14:18:17 * feat: add sca faq * fix: redirect & Image * feat: 放开专家答疑 --------- Co-authored-by: heimanba <[email protected]>
1 parent 8624b9b commit 8efbd7e

File tree

58 files changed

+3945
-641
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+3945
-641
lines changed
 

‎astro.config.mjs

+13-1
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,21 @@ export default defineConfig({
108108
// TODO: 梳理redirects
109109
redirects: {
110110
'/zh-cn/': '/',
111-
'/zh-cn/[...slug]':'/[...slug]',
111+
'/zh-cn/[...slug]': '/[...slug]',
112112
'/en-us/': '/en/',
113+
'/en-us/[...slug]': '/en/[...slug]',
113114
'/[...slug].html': '/[...slug]',
115+
'/docs/2022.0.0.0/[...slug]': '/docs/2022/[...slug]',
116+
'/docs/next/[...slug]': '/docs/2023/[...slug]',
117+
'/docs/2022.0.0.0-RC1/[...slug]': '/docs/2022/[...slug]',
118+
'/docs/2022.0.0.0-RC2/[...slug]': '/docs/2022/[...slug]',
119+
'/docs/2021.0.5.0/[...slug]': '/docs/2021/[...slug]',
120+
'/docs/2021.0.4.0/[...slug]': '/docs/2021/[...slug]',
121+
'/docs/2021.0.1.0/[...slug]': '/docs/2021/[...slug]',
122+
'/docs/2.2.10-RC1/[...slug]': '/docs/2.2.x/[...slug]',
123+
'/docs/2.2.9.RELEASE/[...slug]': '/docs/2.2.x/[...slug]',
124+
'/docs/2.2.8.RELEASE/[...slug]': '/docs/2.2.x/[...slug]',
125+
'/versions': '/docs/2023/overview/what-is-sca/',
114126
'/docs/': '/docs/2023/overview/what-is-sca/',
115127
}
116128
});

‎fix-markdownName.js

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import fs from "fs";
2+
import path from "path";
3+
import { fileURLToPath } from 'url';
4+
5+
const curFilename = fileURLToPath(import.meta.url);
6+
const curDirname = path.dirname(curFilename);
7+
8+
function renameFiles(directory) {
9+
// 检查目录是否存在
10+
if (!fs.existsSync(directory)) {
11+
console.error(`目录不存在: ${directory}`);
12+
return;
13+
}
14+
15+
// 读取目录中的所有文件和子目录
16+
fs.readdir(directory, { withFileTypes: true }, (err, files) => {
17+
if (err) {
18+
console.error('读取目录时出错:', err);
19+
return;
20+
}
21+
22+
files.forEach((file) => {
23+
if (file.isFile() && file.name.startsWith('user-question-history')) {
24+
// 构建当前文件的完整路径
25+
const oldPath = path.join(directory, file.name);
26+
// 构建新文件名(添加前缀"SCA-",更改后缀为".mdx")
27+
const newName = `SCA-${file.name.replace(/\.([a-z]+)$/, '')}.mdx`; // 假设原文件有一个非空的扩展名,并将其替换为.mdx
28+
const newPath = path.join(directory, newName);
29+
30+
// 重命名文件
31+
fs.rename(oldPath, newPath, (error) => {
32+
if (error) {
33+
console.error(`重命名文件失败: ${oldPath} -> ${newPath}`, error);
34+
} else {
35+
console.log(`文件已成功重命名为: ${newPath}`);
36+
}
37+
});
38+
}
39+
});
40+
});
41+
}
42+
43+
// 调用函数,传入目标目录路径
44+
renameFiles(path.join(curDirname, 'src/content/blog/faq'));

0 commit comments

Comments
 (0)
Please sign in to comment.