Skip to content

Commit dc5ca47

Browse files
authored
docs: update giscus integration guide for AstroPaper v5 (#472)
1 parent 77ff6b4 commit dc5ca47

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/data/blog/how-to-integrate-giscus-comments.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
author: FjellOverflow
33
pubDatetime: 2024-07-25T11:11:53Z
4-
modDatetime: 2024-09-25T12:07:53Z
4+
modDatetime: 2025-03-12T12:28:53Z
55
title: How to integrate Giscus comments into AstroPaper
66
slug: how-to-integrate-giscus-comments
77
featured: false
@@ -103,14 +103,14 @@ The embedded script tag in the layout is quite static, with the _Giscus_ configu
103103
Firstly, we are going to install the [React component](https://www.npmjs.com/package/@giscus/react) for _Giscus_:
104104

105105
```bash
106-
npm i @giscus/react
106+
npm i @giscus/react && npx astro add react
107107
```
108108

109109
Then we create a new `Comments.tsx` React component in `src/components`:
110110

111111
```tsx
112112
import Giscus, { type Theme } from "@giscus/react";
113-
import { GISCUS } from "@config";
113+
import { GISCUS } from "@/config";
114114
import { useEffect, useState } from "react";
115115

116116
interface CommentsProps {
@@ -190,12 +190,14 @@ Note that specifying a `theme` here will override the `lightTheme` and `darkThem
190190
To complete the process, add the new Comments component to `src/layouts/PostDetails.astro` (replacing the `script` tag from the previous step).
191191

192192
```diff
193-
+ import Comments from "@components/Comments";
193+
+ import Comments from "@/components/Comments";
194194

195195
<ShareLinks />
196196
</div>
197197

198-
+ <Comments client:only="react" />
198+
+ <Comments client:only="react" />
199+
200+
<hr class="my-6 border-dashed" />
199201

200202
</main>
201203
<Footer />

0 commit comments

Comments
 (0)