Skip to content

Commit 495bf09

Browse files
committed
update
1 parent bb12b15 commit 495bf09

File tree

8 files changed

+13
-117
lines changed

8 files changed

+13
-117
lines changed

packages/pure/components/pages/PageInfo.astro

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ const path = Astro.url.pathname
77
---
88

99
<div class={cn('text-base text-sm text-muted-foreground', className)} {...props}>
10+
<span class='waline-pageview-count' data-path={path}></span> views
1011
{
1112
!hideComment && (
12-
<a href='#giscus-container'>
13-
View comments
13+
<a href='#waline'>
14+
| <span class='waline-comment-count' data-path={path} /> comments
1415
</a>
1516
)
1617
}

packages/pure/types/integrations-config.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -52,30 +52,6 @@ export const IntegrationConfigSchema = () =>
5252
emoji: z.array(z.string()).optional(),
5353
/** Additional configurations for the Waline comment system. */
5454
additionalConfigs: z.record(z.string(), z.any()).default({})
55-
}),
56-
57-
/** The Giscus comment system */
58-
giscus: z.object({
59-
/** Enable the Giscus comment system. */
60-
enable: z.boolean().default(false),
61-
/** The GitHub repository to use for comments. */
62-
repo: z.string(),
63-
/** The repository ID. */
64-
repoId: z.string(),
65-
/** The discussion category name. */
66-
category: z.string(),
67-
/** The discussion category ID. */
68-
categoryId: z.string(),
69-
/** The mapping between the current page and GitHub discussion. */
70-
mapping: z.string().default('pathname'),
71-
/** Whether to enable reactions for the comments. */
72-
reactionsEnabled: z.string().default('1'),
73-
/** Whether the metadata should be sent to the parent window. */
74-
emitMetadata: z.string().default('0'),
75-
/** Where the comment box should be placed. */
76-
inputPosition: z.string().default('top'),
77-
/** The language Giscus should use. */
78-
lang: z.string().default('en')
7955
})
8056
})
8157

src/components/GiscusComment.astro

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +0,0 @@
1-
---
2-
import config from '../site.config'
3-
4-
const { class: className } = Astro.props
5-
---
6-
7-
{
8-
config.integ.giscus.enable && (
9-
<div id="giscus-container" class={className}></div>
10-
)
11-
}
12-
13-
<script>
14-
import config from '../site.config'
15-
16-
// Only load if giscus is enabled
17-
if (config.integ.giscus?.enable) {
18-
const giscusConfig = config.integ.giscus;
19-
20-
// Create script element
21-
const script = document.createElement('script');
22-
script.src = "https://giscus.app/client.js";
23-
script.setAttribute("data-repo", giscusConfig.repo);
24-
script.setAttribute("data-repo-id", giscusConfig.repoId);
25-
script.setAttribute("data-category", giscusConfig.category);
26-
script.setAttribute("data-category-id", giscusConfig.categoryId);
27-
script.setAttribute("data-mapping", giscusConfig.mapping);
28-
script.setAttribute("data-strict", "0");
29-
script.setAttribute("data-reactions-enabled", giscusConfig.reactionsEnabled);
30-
script.setAttribute("data-emit-metadata", giscusConfig.emitMetadata);
31-
script.setAttribute("data-input-position", giscusConfig.inputPosition);
32-
script.setAttribute("data-theme", document.documentElement.classList.contains('dark') ? 'dark' : 'light');
33-
script.setAttribute("data-lang", giscusConfig.lang);
34-
script.setAttribute("data-loading", "lazy");
35-
script.setAttribute("crossorigin", "anonymous");
36-
script.async = true;
37-
38-
// Add script to container
39-
const container = document.getElementById('giscus-container');
40-
if (container) {
41-
container.appendChild(script);
42-
}
43-
}
44-
</script>

src/layouts/BlogPost.astro

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ import type { CollectionEntry } from 'astro:content'
55
// Plugin styles
66
import 'katex/dist/katex.min.css'
77
8-
import { MediumZoom } from 'astro-pure/advanced'
8+
import { Comment, MediumZoom } from 'astro-pure/advanced'
99
import { ArticleBottom, Copyright, Hero, TOC } from 'astro-pure/components/pages'
1010
import PageLayout from '@/layouts/ContentLayout.astro'
1111
import { integ } from '@/site-config'
12-
import GiscusComment from '@/components/GiscusComment.astro'
1312
1413
interface Props {
1514
post: CollectionEntry<'blog'>
@@ -61,7 +60,7 @@ const primaryColor = data.heroImage?.color ?? 'hsl(var(--primary) / var(--un-tex
6160
{/* Article recommend */}
6261
<ArticleBottom collections={posts} {id} class='mt-3 sm:mt-6' />
6362
{/* Comment */}
64-
{!isDraft && enableComment && <GiscusComment class='mt-3 sm:mt-6' />}
63+
{!isDraft && enableComment && <Comment class='mt-3 sm:mt-6' />}
6564
</Fragment>
6665

6766
<slot name='bottom-sidebar' slot='bottom-sidebar' />

src/pages/about/index.astro

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
import { Image } from 'astro:assets'
3-
import { Spoiler, Timeline, Button, Collapse } from 'astro-pure/user'
3+
import { Comment } from 'astro-pure/advanced'
4+
import { Button, Collapse, Spoiler, Timeline } from 'astro-pure/user'
45
import PageLayout from '@/layouts/CommonPage.astro'
56
import Substats from '@/components/about/Substats.astro'
67
import ToolSection from '@/components/about/ToolSection.astro'
7-
import GiscusComment from '@/components/GiscusComment.astro'
88
99
import avatar from '@/assets/avatar.png'
1010
import github from '@/assets/icons/social/github.svg'
@@ -147,7 +147,7 @@ const headings = [
147147
<li>
148148
Site hosting: <a href='https://github.com/Lexciese/lexciese.github.io' target='_blank'>GitHub Pages</a>
149149
</li>
150-
<li>Comment system: <a href='https://giscus.app/' target='_blank'>Giscus</a></li>
150+
<li>Comment system: <a href='https://waline.js.org' target='_blank'>Waline</a></li>
151151
</ul>
152-
<GiscusComment slot='bottom' />
152+
<Comment slot='bottom' />
153153
</PageLayout>

src/pages/links/index.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
import links from 'public/links.json'
33
import config from 'virtual:config'
44
5+
import { Comment } from 'astro-pure/advanced'
56
import { Collapse, Timeline } from 'astro-pure/user'
67
import PageLayout from '@/layouts/CommonPage.astro'
78
import FriendList from '@/components/links/FriendList.astro'
8-
import GiscusComment from '@/components/GiscusComment.astro'
99
1010
const headings = [
1111
{ depth: 2, slug: 'professional', text: 'Professional' },
@@ -90,5 +90,5 @@ const linksConf = config.integ.links
9090
}
9191
</blockquote>
9292

93-
<GiscusComment slot='bottom' />
93+
<Comment slot='bottom' />
9494
</PageLayout>

src/site.config.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,14 @@ export const integ: IntegrationUserConfig = {
127127
},
128128
// Comment system
129129
waline: {
130-
enable: false, // Disabled - not suitable for static sites on GitHub Pages
130+
enable: false,
131131
// Server service link - you need to set up your own Waline server
132132
// Follow the guide at https://waline.js.org/en/guide/get-started.html
133133
// Quick deploy options:
134134
// - Vercel: https://waline.js.org/en/guide/get-started.html#vercel-deploy
135135
// - Netlify: https://waline.js.org/en/guide/get-started.html#netlify-deploy
136136
// After deployment, replace this URL with your own Waline server URL
137-
server: '',
137+
server: 'YOUR_WALINE_SERVER_URL_HERE',
138138
// Refer https://waline.js.org/en/guide/features/emoji.html
139139
emoji: ['bmoji', 'weibo'],
140140
// Refer https://waline.js.org/en/reference/client/props.html
@@ -148,21 +148,6 @@ export const integ: IntegrationUserConfig = {
148148
},
149149
imageUploader: false
150150
}
151-
},
152-
// Giscus comment system - uses GitHub Discussions as backend
153-
// Learn more and get your settings at https://giscus.app/
154-
giscus: {
155-
enable: true,
156-
// Fill in the following values from https://giscus.app/
157-
repo: 'Lexciese/lexciese.github.io',
158-
repoId: 'R_kgDOOYZ11g',
159-
category: 'Q&A',
160-
categoryId: 'DIC_kwDOOYZ11s4CpC8b',
161-
mapping: 'pathname',
162-
reactionsEnabled: '1',
163-
emitMetadata: '0',
164-
inputPosition: 'bottom',
165-
lang: 'en'
166151
}
167152
}
168153

src/type.d.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,3 @@
1-
import { IntegrationUserConfig as BaseIntegrationUserConfig } from 'astro-pure/types'
2-
3-
declare module 'astro-pure/types' {
4-
interface GiscusConfig {
5-
enable: boolean
6-
repo: string
7-
repoId: string
8-
category: string
9-
categoryId: string
10-
mapping: string
11-
reactionsEnabled: string
12-
emitMetadata: string
13-
inputPosition: string
14-
lang: string
15-
}
16-
17-
interface IntegrationUserConfig extends BaseIntegrationUserConfig {
18-
giscus?: GiscusConfig
19-
}
20-
}
21-
221
declare module 'virtual:config' {
232
const Config: import('astro-pure/types').ConfigOutput
243
export default Config

0 commit comments

Comments
 (0)