docs: 更新仓库链接和文档内容
将 GitHub 仓库链接从 'anghunk/CWD' 统一更新为 'anghunk/cwd' 更新前端配置文档,增加 Vue 组件示例和其他框架说明 修改导航栏"部署文档"为"快速开始"
This commit is contained in:
2
.github/workflows/docs.yml
vendored
2
.github/workflows/docs.yml
vendored
@@ -11,7 +11,7 @@ jobs:
|
|||||||
uses: jenkey2011/vuepress-deploy@master
|
uses: jenkey2011/vuepress-deploy@master
|
||||||
env:
|
env:
|
||||||
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||||
TARGET_REPO: anghunk/CWD
|
TARGET_REPO: anghunk/cwd
|
||||||
TARGET_BRANCH: gh-pages
|
TARGET_BRANCH: gh-pages
|
||||||
BUILD_SCRIPT: yarn --cwd docs && yarn --cwd docs build
|
BUILD_SCRIPT: yarn --cwd docs && yarn --cwd docs build
|
||||||
BUILD_DIR: docs/.vitepress/dist/
|
BUILD_DIR: docs/.vitepress/dist/
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
>
|
>
|
||||||
> 目前处于内测阶段,欢迎参与测试。
|
> 目前处于内测阶段,欢迎参与测试。
|
||||||
|
|
||||||
<img src="https://github.com/anghunk/CWD/blob/main/icon.png?raw=true" width="72" />
|
<img src="https://github.com/anghunk/cwd/blob/main/icon.png?raw=true" width="72" />
|
||||||
|
|
||||||
# CWD (Cloudflare Workers Discuss)
|
# CWD (Cloudflare Workers Discuss)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<link rel="shortcut icon" href="https://github.com/anghunk/CWD/blob/main/icon.png?raw=true"
|
<link rel="shortcut icon" href="https://github.com/anghunk/cwd/blob/main/icon.png?raw=true"
|
||||||
type="image/x-icon">
|
type="image/x-icon">
|
||||||
<title>CWD 评论后台</title>
|
<title>CWD 评论后台</title>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<a class="layout-button" href="https://cwd-docs.zishu.me" target="_blank">
|
<a class="layout-button" href="https://cwd-docs.zishu.me" target="_blank">
|
||||||
使用文档
|
使用文档
|
||||||
</a>
|
</a>
|
||||||
<a class="layout-button" href="https://github.com/anghunk/CWD" target="_blank">
|
<a class="layout-button" href="https://github.com/anghunk/cwd" target="_blank">
|
||||||
Github
|
Github
|
||||||
</a>
|
</a>
|
||||||
<button class="layout-button" @click="handleLogout">退出</button>
|
<button class="layout-button" @click="handleLogout">退出</button>
|
||||||
@@ -156,7 +156,7 @@ function openDocs() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function openGithub() {
|
function openGithub() {
|
||||||
window.open("https://github.com/anghunk/CWD", "_blank");
|
window.open("https://github.com/anghunk/cwd", "_blank");
|
||||||
closeActions();
|
closeActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ app.use('/admin/*', async (c, next) => {
|
|||||||
|
|
||||||
app.get('/', (c) => {
|
app.get('/', (c) => {
|
||||||
return c.html(
|
return c.html(
|
||||||
`CWD 评论部署成功,当前版本 ${VERSION},<a href="https://github.com/anghunk/CWD" target="_blank" rel="noreferrer">查看文档</a>`
|
`CWD 评论部署成功,当前版本 ${VERSION},<a href="https://github.com/anghunk/cwd" target="_blank" rel="noreferrer">查看文档</a>`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export default defineConfig({
|
|||||||
'link',
|
'link',
|
||||||
{
|
{
|
||||||
rel: 'icon',
|
rel: 'icon',
|
||||||
href: 'https://github.com/anghunk/CWD/blob/main/icon.png?raw=true',
|
href: 'https://github.com/anghunk/cwd/blob/main/icon.png?raw=true',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@@ -24,10 +24,10 @@ export default defineConfig({
|
|||||||
label: 'On this page',
|
label: 'On this page',
|
||||||
},
|
},
|
||||||
editLink: {
|
editLink: {
|
||||||
pattern: 'https://github.com/anghunk/CWD/blob/main/docs/:path',
|
pattern: 'https://github.com/anghunk/cwd/blob/main/docs/:path',
|
||||||
text: '在 GitHub 上编辑此页面',
|
text: '在 GitHub 上编辑此页面',
|
||||||
},
|
},
|
||||||
socialLinks: [{ icon: 'github', link: 'https://github.com/anghunk/CWD' }],
|
socialLinks: [{ icon: 'github', link: 'https://github.com/anghunk/cwd' }],
|
||||||
|
|
||||||
lastUpdated: true,
|
lastUpdated: true,
|
||||||
lastUpdatedText: '最后更新于',
|
lastUpdatedText: '最后更新于',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export default [
|
export default [
|
||||||
{ text: '首页', link: '/' },
|
{ text: '首页', link: '/' },
|
||||||
{ text: '部署文档', link: '/guide/backend-config' },
|
{ text: '快速开始', link: '/guide/backend-config' },
|
||||||
{ text: 'API 文档', link: '/api/overview' },
|
{ text: 'API 文档', link: '/api/overview' },
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<script>
|
<script>
|
||||||
const comments = new CWDComments({
|
const comments = new CWDComments({
|
||||||
el: '#comments',
|
el: '#comments',
|
||||||
apiBaseUrl: 'https://your-api.example.com', // 你部署的后端接口地址
|
apiBaseUrl: 'https://your-api.example.com', // 换成你的 API 地址
|
||||||
});
|
});
|
||||||
comments.mount();
|
comments.mount();
|
||||||
</script>
|
</script>
|
||||||
@@ -45,24 +45,28 @@
|
|||||||
| `updateConfig(config)` | 更新配置(支持动态切换主题等) |
|
| `updateConfig(config)` | 更新配置(支持动态切换主题等) |
|
||||||
| `getConfig()` | 获取当前配置 |
|
| `getConfig()` | 获取当前配置 |
|
||||||
|
|
||||||
## 使用示例
|
**使用示例**
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
// 动态切换主题
|
// 动态切换主题
|
||||||
comments.updateConfig({ theme: 'dark' });
|
comments.updateConfig({ theme: 'dark' });
|
||||||
```
|
```
|
||||||
|
|
||||||
### 博客程序使用示例
|
## 其他框架示例
|
||||||
|
|
||||||
|
如果你有其他博客框架的需求,欢迎在下方评论区留言。
|
||||||
|
|
||||||
### HTML
|
### HTML
|
||||||
|
|
||||||
|
此方法适用于绝大多数博客框架,包括 Hexo、Hugo、Jekyll、WordPress 等。
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<div id="comments"></div>
|
<div id="comments"></div>
|
||||||
<script src="https://cwd.zishu.me/cwd.js"></script>
|
<script src="https://cwd.zishu.me/cwd.js"></script>
|
||||||
<script>
|
<script>
|
||||||
const comments = new CWDComments({
|
const comments = new CWDComments({
|
||||||
el: '#comments',
|
el: '#comments',
|
||||||
apiBaseUrl: 'https://your-api.example.com', // 你部署的后端接口地址
|
apiBaseUrl: 'https://your-api.example.com', // 换成你的 API 地址
|
||||||
});
|
});
|
||||||
comments.mount();
|
comments.mount();
|
||||||
</script>
|
</script>
|
||||||
@@ -77,9 +81,55 @@ comments.updateConfig({ theme: 'dark' });
|
|||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const comments = new window.CWDComments({
|
const comments = new window.CWDComments({
|
||||||
el: '#comments',
|
el: '#comments',
|
||||||
apiBaseUrl: 'https://your-api.example.com',
|
apiBaseUrl: 'https://your-api.example.com', // 换成你的 API 地址
|
||||||
});
|
});
|
||||||
comments.mount();
|
comments.mount();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Vue
|
||||||
|
|
||||||
|
在 Vue 单文件组件里封装。
|
||||||
|
|
||||||
|
`CommentsWidget.vue`:
|
||||||
|
|
||||||
|
```html
|
||||||
|
<template>
|
||||||
|
<div ref="comments"></div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { onMounted, onBeforeUnmount, ref } from 'vue';
|
||||||
|
|
||||||
|
const comments = ref(null);
|
||||||
|
let instance = null;
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
if (!window.CWDComments) {
|
||||||
|
await loadScript('https://cwd.zishu.me/cwd.js');
|
||||||
|
}
|
||||||
|
|
||||||
|
instance = new window.CWDComments({
|
||||||
|
el: comments.value,
|
||||||
|
apiBaseUrl: 'https://your-api.example.com', // 换成你的 API 地址
|
||||||
|
});
|
||||||
|
instance.mount();
|
||||||
|
});
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
instance = null;
|
||||||
|
});
|
||||||
|
|
||||||
|
function loadScript(src) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const script = document.createElement('script');
|
||||||
|
script.src = src;
|
||||||
|
script.async = true;
|
||||||
|
script.onload = () => resolve();
|
||||||
|
script.onerror = (e) => reject(e);
|
||||||
|
document.head.appendChild(script);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
```
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ CWD 评论系统。
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 克隆项目
|
# 克隆项目
|
||||||
git clone https://github.com/anghunk/CWD
|
git clone https://github.com/anghunk/cwd
|
||||||
|
|
||||||
# API 项目
|
# API 项目
|
||||||
cd cwd-api
|
cd cwd-api
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ hero:
|
|||||||
name: CWD 评论系统
|
name: CWD 评论系统
|
||||||
tagline: 基于 Cloudflare Workers 与全球边缘网络的免服务器、极速安全、即插即用评论系统。
|
tagline: 基于 Cloudflare Workers 与全球边缘网络的免服务器、极速安全、即插即用评论系统。
|
||||||
image:
|
image:
|
||||||
src: https://github.com/anghunk/CWD/blob/main/icon.png?raw=true
|
src: https://github.com/anghunk/cwd/blob/main/icon.png?raw=true
|
||||||
alt: 文档封面
|
alt: 文档封面
|
||||||
actions:
|
actions:
|
||||||
- theme: brand
|
- theme: brand
|
||||||
|
|||||||
Reference in New Issue
Block a user