diff --git a/docs/.vitepress/components/githubStar.vue b/docs/.vitepress/components/githubStar.vue
new file mode 100644
index 0000000..f9d0416
--- /dev/null
+++ b/docs/.vitepress/components/githubStar.vue
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+ Star
+ {{ formattedStars }}
+
+
+
+
+
+
diff --git a/docs/.vitepress/config.mjs b/docs/.vitepress/config.mjs
index 292f443..15391d3 100644
--- a/docs/.vitepress/config.mjs
+++ b/docs/.vitepress/config.mjs
@@ -29,10 +29,7 @@ export default defineConfig({
pattern: 'https://github.com/anghunk/cwd/blob/main/docs/:path',
text: '在 GitHub 上编辑此页面',
},
- socialLinks: [
- { icon: 'github', link: 'https://github.com/anghunk/cwd' },
- { icon: 'discord', link: 'https://discord.gg/VahC3r7t' },
- ],
+ socialLinks: [{ icon: 'discord', link: 'https://discord.gg/VahC3r7t' }],
lastUpdated: true,
lastUpdatedText: '最后更新于',
footer: {
diff --git a/docs/.vitepress/theme/custom.css b/docs/.vitepress/theme/custom.css
index dad860c..b051e34 100644
--- a/docs/.vitepress/theme/custom.css
+++ b/docs/.vitepress/theme/custom.css
@@ -22,4 +22,41 @@
.image-src {
max-width: 200px !important;
-}
\ No newline at end of file
+}
+
+.github-star-link {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ padding: 2px 8px;
+ margin-left: 10px;
+ border-radius: 999px;
+ border: 1px solid var(--vp-c-border);
+ font-size: 12px;
+ color: var(--vp-c-text-1);
+ text-decoration: none;
+ transition:
+ background-color 0.2s ease,
+ border-color 0.2s ease,
+ color 0.2s ease;
+}
+
+.github-star-link:hover {
+ background-color: var(--vp-c-bg-soft);
+ border-color: var(--vp-c-brand-1);
+ color: var(--vp-c-brand-1);
+}
+
+.github-star-icon svg {
+ width: 16px;
+}
+
+.github-star-text {
+ display: inline-flex;
+ align-items: center;
+}
+
+.github-star-count {
+ margin-left: 4px;
+ font-weight: 600;
+}
diff --git a/docs/.vitepress/theme/index.js b/docs/.vitepress/theme/index.js
index 0c76980..94b8a22 100644
--- a/docs/.vitepress/theme/index.js
+++ b/docs/.vitepress/theme/index.js
@@ -1,6 +1,7 @@
import DefaultTheme from 'vitepress/theme';
import { h } from 'vue';
import FooterDoc from '../components/footerDoc.vue';
+import GitHubStar from '../components/githubStar.vue';
import './custom.css';
export default {
@@ -11,6 +12,7 @@ export default {
return h(Layout, null, {
'doc-footer-before': () => h(FooterDoc),
'home-features-after': () => h('div', { class: 'extra-class' }, [h(FooterDoc)]),
+ 'nav-bar-content-after': () => h(GitHubStar),
});
},
};
diff --git a/docs/guide/frontend-config.md b/docs/guide/frontend-config.md
index 8c13de3..d3d307f 100644
--- a/docs/guide/frontend-config.md
+++ b/docs/guide/frontend-config.md
@@ -2,6 +2,8 @@
**这里仅提供一套开箱即用的方案,如果是个人开发者可以根据 [API 文档](../api/overview) 自行编写前端评论组件。**
+组件源码目录:`/docs/widget`
+
## 组件特性
CWD 评论组件采用 **Shadow DOM** 技术构建,基于独立根节点渲染,具备以下优势:
diff --git a/docs/guide/update-version.md b/docs/guide/update-version.md
index 548ae88..2dd03c0 100644
--- a/docs/guide/update-version.md
+++ b/docs/guide/update-version.md
@@ -37,4 +37,4 @@ npm run build
如果使用官方评论端 js `https://cwd.js.org/cwd.js`,不需要更新。
-如果你想自行托管,请使用打包命令,对仓库 `@docs/widget` 文件夹进行构建,然后把 `dist` 文件夹中的最新的 `cwd.js` 文件上传到你托管的地方。
+如果你想自行托管,请使用打包命令,对仓库 `/docs/widget` 文件夹进行构建,然后把 `dist` 文件夹中的最新的 `cwd.js` 文件上传到你托管的地方。