Replies: 1 comment
-
|
Yes! Giscus works great with Next.js App Router. Here's how to set it up: Using the @giscus/react component:
npm install @giscus/react
// components/Comments.tsx
'use client';
import Giscus from '@giscus/react';
export default function Comments() {
return (
<Giscus
repo="your-username/your-repo"
repoId="your-repo-id"
category="Announcements"
categoryId="your-category-id"
mapping="pathname"
reactionsEnabled="1"
emitMetadata="0"
inputPosition="top"
theme="preferred_color_scheme"
lang="en"
loading="lazy"
/>
);
}
// app/blog/[slug]/page.tsx
import Comments from '@/components/Comments';
export default function BlogPost() {
return (
<article>
{/* Your content */}
<Comments />
</article>
);
}Key points for App Router:
The component handles all the iframe communication automatically. Hope this helps! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am using Next.js App Router(v.15) with "@giscus/react" version 3.1.0. I am getting this error:
Here is my code
I have configured Giscus correctly with the repo, and supplied the correct value for the
Thanks for your help.
Beta Was this translation helpful? Give feedback.
All reactions