Skip to content

Commit

Permalink
feat: 二级路由更新
Browse files Browse the repository at this point in the history
  • Loading branch information
ch1ny committed Mar 3, 2024
1 parent 6fb09da commit eb10db3
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 15 deletions.
17 changes: 11 additions & 6 deletions docs/docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const sideBar = [
const links: { url: string; lastmod?: number }[] = [];

export default defineConfig({
base: '/creta',
title: 'creta',
description:
'Scaffolding to create a react+electron+typescript App.帮您快速搭建基于 React 和 TypeScript 的 electron 应用。',
Expand All @@ -55,7 +56,7 @@ export default defineConfig({
'link',
{
rel: 'icon',
href: 'https://assets.kira.host/image/creta_logo_colored.svg',
href: 'https://kira.host/assets/image/creta_logo_colored.svg',
},
],
],
Expand Down Expand Up @@ -85,14 +86,18 @@ export default defineConfig({
transformHtml(_code, id, ctx) {
if (/[\\/]404\.html$/.test(id)) return;

links.push({
url: ctx.pageData.relativePath.replace(/((^|\/)index)?\.md$/, '$2.html'),
const url = ctx.pageData.relativePath.replace(/((^|\/)index)?\.md$/, `$2.html`);

const link = {
url: `${ctx.siteConfig.site.base}${url === '.html' ? 'index.html' : url}`,
lastmod: ctx.pageData.lastUpdated,
});
}

links.push(link);
},
buildEnd(siteConfig) {
const { outDir } = siteConfig;
const sitemap = new SitemapStream({ hostname: 'https://creta.kira.host' });
const { outDir, site: { base } } = siteConfig;
const sitemap = new SitemapStream({ hostname: `https://kira.host${base}` });
const sitemapWriteStream = fs.createWriteStream(path.resolve(outDir, 'sitemap.xml'));
sitemap.pipe(sitemapWriteStream);
links.forEach((link) => sitemap.write(link));
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/guide/creta.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 什么是 creta

<div style="width: 100%; display: flex; justify-content: center;">
<img src="https://assets.kira.host/image/creta_logo_colored.svg" alt="LOGO" width="150" />
<img src="https://kira.host/assets/image/creta_logo_colored.svg" alt="LOGO" width="150" />
</div>

<div style="width: 100%; display: flex;">
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ hero:
text: Create React + Electron + TypeScript App.
tagline: 帮您快速搭建基于 React 和 TypeScript 的 electron 应用
image:
src: https://assets.kira.host/image/creta_logo_colored.svg
src: https://kira.host/assets/image/creta_logo_colored.svg
alt: Creta
actions:
- theme: brand
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![npm version](https://badgen.net/npm/v/creta)](https://www.npmjs.com/package/creta) [![npm weekly download](https://badgen.net/npm/dw/creta)](https://www.npmjs.com/package/creta) [![github stars](https://badgen.net/github/stars/ch1ny/creta)](https://github.com/ch1ny/creta/stargazers)

<div style="width: 100%; display: flex; justify-content: center;">
<img src="https://assets.kira.host/image/creta_logo_colored.svg" alt="LOGO" width="150" />
<img src="https://kira.host/assets/image/creta_logo_colored.svg" alt="LOGO" width="150" />
</div>

## 介绍 - Introduction
Expand All @@ -12,7 +12,7 @@

## 使用 - Usage

> 欢迎阅读我们提供的[使用手册](https://creta.kira.host/)
> 欢迎阅读我们提供的[使用手册](https://kira.host/creta/)
**creta** 使用起来非常方便,只需一行指令即可搭建出 React+TypeScript+Electron 三合一的应用模板。
使用该脚手架前需要保证在当前机器上已安装有 **NodeJS** 环境,不过我相信绝大多数前端程序员都以具备了这一条前置条件,因此这里我便默认阅读本文的各位已经能够执行后续的操作了。
Expand Down
2 changes: 1 addition & 1 deletion src/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"type": "git",
"url": "https://github.com/ch1ny/creta.git"
},
"homepage": "https://creta.kira.host/",
"homepage": "https://kira.host/creta/",
"bugs": {
"url": "https://github.com/ch1ny/creta/issues"
},
Expand Down
2 changes: 1 addition & 1 deletion src/cli/templates/default/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

This is a electron programme created with `creta`.

You can visit and get help from [here](https://creta.kira.host/)
You can visit and get help from [here](https://kira.host/creta/)
4 changes: 2 additions & 2 deletions src/creta/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![npm version](https://badgen.net/npm/v/creta)](https://www.npmjs.com/package/creta) [![npm weekly download](https://badgen.net/npm/dw/creta)](https://www.npmjs.com/package/creta) [![github stars](https://badgen.net/github/stars/ch1ny/creta)](https://github.com/ch1ny/creta/stargazers)

<div style="width: 100%; display: flex; justify-content: center;">
<img src="https://assets.kira.host/image/creta_logo_colored.svg" alt="LOGO" width="150" />
<img src="https://kira.host/assets/image/creta_logo_colored.svg" alt="LOGO" width="150" />
</div>

## 介绍 - Introduction
Expand All @@ -12,7 +12,7 @@

## 使用 - Usage

> 欢迎阅读我们提供的[使用手册](https://creta.kira.host/)
> 欢迎阅读我们提供的[使用手册](https://kira.host/creta/)
**creta** 使用起来非常方便,只需一行指令即可搭建出 React+TypeScript+Electron 三合一的应用模板。
使用该脚手架前需要保证在当前机器上已安装有 **NodeJS** 环境,不过我相信绝大多数前端程序员都以具备了这一条前置条件,因此这里我便默认阅读本文的各位已经能够执行后续的操作了。
Expand Down
2 changes: 1 addition & 1 deletion src/creta/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"type": "git",
"url": "https://github.com/ch1ny/creta.git"
},
"homepage": "https://creta.kira.host/",
"homepage": "https://kira.host/creta/",
"bugs": {
"url": "https://github.com/ch1ny/creta/issues"
},
Expand Down

0 comments on commit eb10db3

Please sign in to comment.