Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to enable discussions for a blogHow to enable discussions for a blog #889

Open
kkkh opened this issue Apr 11, 2024 · 2 comments
Open
Labels
help wanted Extra attention is needed

Comments

@kkkh
Copy link

kkkh commented Apr 11, 2024

How to enable discussions for a blog, I opened the discussion but it gives a prompt of
An error occurred: giscus is not installed on this repository
How can I get this feature of the page to work.
I have gotten the js code through https://giscus.app/, how do I make it work? Where exactly do I add it? I'm sorry for the inconvenience.

@timlrx timlrx added the help wanted Extra attention is needed label Apr 17, 2024
@timlrx
Copy link
Owner

timlrx commented Apr 17, 2024

Make sure you have followed the instructions listed in https://giscus.app i.e.

  1. The repository is public, otherwise visitors will not be able to view the discussion.
  2. The giscus app is installed, otherwise visitors will not be able to comment and react.
  3. The Discussions feature is turned on by enabling it for your repository.

Choose a discussion category e..g Announcements

Under enable discus, you will see a script like this:

<script src="https://giscus.app/client.js"
        data-repo="timlrx/tailwind-nextjs-starter-blog"
        data-repo-id="ABCDEDFG"
        data-category="Announcements"
        data-category-id="QWERTYYUIOP"
        data-mapping="pathname"
        data-strict="0"
        data-reactions-enabled="1"
        data-emit-metadata="0"
        data-input-position="bottom"
        data-theme="preferred_color_scheme"
        data-lang="en"
        crossorigin="anonymous"
        async>
</script>

As seen in .env.example, set the following environment variables corresponding to the above fields
e.g.
NEXT_PUBLIC_GISCUS_REPO=timlrx/tailwind-nextjs-starter-blog
NEXT_PUBLIC_GISCUS_REPOSITORY_ID=ABCDEDFG
NEXT_PUBLIC_GISCUS_CATEGORY=Announcements
NEXT_PUBLIC_GISCUS_CATEGORY_ID=QWERTYYUIOP

@rmourey26
Copy link

Hi I am having an issue enabling giscus comments. I followed the instructions at giscus.app, set the ENV vars in vercel, and nothing renders after loading comments.

Do I have to place the giscus script in app/layout or layouts?

Does the template automatically handle the login with github functionality or should I handle that separately by creating a login in with Github oauth config?

Thanks and great work on your template!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants