|
1 | 1 | --- |
2 | 2 | author: FjellOverflow |
3 | 3 | pubDatetime: 2024-07-25T11:11:53Z |
4 | | -modDatetime: 2024-09-25T12:07:53Z |
| 4 | +modDatetime: 2025-03-12T12:28:53Z |
5 | 5 | title: How to integrate Giscus comments into AstroPaper |
6 | 6 | slug: how-to-integrate-giscus-comments |
7 | 7 | featured: false |
@@ -103,14 +103,14 @@ The embedded script tag in the layout is quite static, with the _Giscus_ configu |
103 | 103 | Firstly, we are going to install the [React component](https://www.npmjs.com/package/@giscus/react) for _Giscus_: |
104 | 104 |
|
105 | 105 | ```bash |
106 | | -npm i @giscus/react |
| 106 | +npm i @giscus/react && npx astro add react |
107 | 107 | ``` |
108 | 108 |
|
109 | 109 | Then we create a new `Comments.tsx` React component in `src/components`: |
110 | 110 |
|
111 | 111 | ```tsx |
112 | 112 | import Giscus, { type Theme } from "@giscus/react"; |
113 | | -import { GISCUS } from "@config"; |
| 113 | +import { GISCUS } from "@/config"; |
114 | 114 | import { useEffect, useState } from "react"; |
115 | 115 |
|
116 | 116 | interface CommentsProps { |
@@ -190,12 +190,14 @@ Note that specifying a `theme` here will override the `lightTheme` and `darkThem |
190 | 190 | To complete the process, add the new Comments component to `src/layouts/PostDetails.astro` (replacing the `script` tag from the previous step). |
191 | 191 |
|
192 | 192 | ```diff |
193 | | -+ import Comments from "@components/Comments"; |
| 193 | ++ import Comments from "@/components/Comments"; |
194 | 194 |
|
195 | 195 | <ShareLinks /> |
196 | 196 | </div> |
197 | 197 |
|
198 | | -+ <Comments client:only="react" /> |
| 198 | ++ <Comments client:only="react" /> |
| 199 | + |
| 200 | + <hr class="my-6 border-dashed" /> |
199 | 201 |
|
200 | 202 | </main> |
201 | 203 | <Footer /> |
|
0 commit comments