You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[utterances](https://utteranc.es)for blog comments
32
-
- sync light / dark mode for utterances
33
-
-[MathJax style optimization for mobile](https://github.com/vuejs/vitepress/issues/3914#issuecomment-2138527325)
34
-
-prev / next linkswithout fontmatter setting
35
-
- support footnote by [markdown-it-footnote](https://github.com/markdown-it/markdown-it-footnote)
24
+
-🖋️ **Generate new posts via CLI** – Scaffold articles instantly with a single command
25
+
-🤖 **AI-powered summary** – Real-time article overview powered by AI
26
+
-📈 **SEO-ready with JSON-LD** – Auto-injected schema data on every post page
27
+
-🎨 **Style with Tailwind CSS** – Responsive design that looks great in both light/dark mode
28
+
-📚 **Pagination powered by History API** – Smooth navigation between post lists
29
+
-🗺️ [**Automatic sitemap generation**](https://vitepress.dev/guide/sitemap-generation#sitemap-generation) – Boost your site's visibility in search engines
30
+
-🧩 **Modular config integration** – Centralized control for site and theme settings
31
+
-💬 [**Utterances for comments**](https://utteranc.es)– GitHub-powered commenting system
32
+
-🔄 **Theme-aware Utterances** – Auto-sync comment box with light/dark mode
33
+
-📐 [**Optimized MathJax rendering**](https://github.com/vuejs/vitepress/issues/3914#issuecomment-2138527325) – Clean, responsive math formulas on mobile
34
+
-⏭️ **Prev/Next post links** – Auto-generated without extra frontmatter
35
+
-🦶 **Footnote support** – Powered by [markdown-it-footnote](https://github.com/markdown-it/markdown-it-footnote) for scholarly notes
36
36
37
37
## Prerequisite
38
38
-[Node.js](https://nodejs.org) version 18 or higher.
39
39
40
40
## Usage
41
41
- Clone the project.
42
42
- Edit [theme config](/.vitepress/theme/config.ts) and [public files](/public/) for custom.
43
+
- To enable the AI-powered realtime summary, you need to sign up for [Cloudflare](https://www.cloudflare.com), create your own AI Worker (free), and configure the Worker API in the theme config.
44
+
```
45
+
# worker.js
46
+
const corsHeaders = {
47
+
'Access-Control-Allow-Origin': 'YOUR_HOST',
48
+
'Access-Control-Allow-Methods': 'POST, OPTIONS',
49
+
'Access-Control-Allow-Headers': 'Content-Type',
50
+
'Content-Type': 'application/json'
51
+
};
52
+
53
+
const sendErrorResponse = (message, status = 500) => {
54
+
return new Response(JSON.stringify({ error: message }), {
55
+
status,
56
+
headers: corsHeaders
57
+
});
58
+
};
59
+
60
+
export default {
61
+
async fetch(request, env) {
62
+
if (request.method === 'OPTIONS') {
63
+
return new Response(null, { headers: corsHeaders });
64
+
}
65
+
66
+
if (request.method !== 'POST') {
67
+
return sendErrorResponse('Only POST requests are allowed', 405);
68
+
}
69
+
70
+
try {
71
+
const { message } = await request.json();
72
+
if (!message) {
73
+
return sendErrorResponse('Missing message in request body', 400);
const prompt = `You are a professional summarization assistant. Based on the content I provide, generate a summary no longer than 60 characters, and return only the summary—no additional text: ${message}`;
79
+
const apiResponse = await fetch(
80
+
gateway,
81
+
{
82
+
method: 'POST',
83
+
headers: {
84
+
'Content-Type': 'application/json',
85
+
'Authorization': `${env.key}`
86
+
},
87
+
body: JSON.stringify({'prompt': prompt})
88
+
}
89
+
);
90
+
91
+
if (!apiResponse.ok) {
92
+
throw new Error(`Cloudflare Workers AI error: ${apiResponse.statusText}`);
93
+
}
94
+
95
+
const response = await apiResponse.json();
96
+
return new Response(JSON.stringify({ response }), { headers: corsHeaders });
97
+
} catch (error) {
98
+
return sendErrorResponse(error.message);
99
+
}
100
+
}
101
+
};
102
+
```
43
103
- Launch terminal and execute commands as follows :
0 commit comments