Open pourmand1376 opened 4 months ago
or is there any api to get latest comments?
ok, we can use GraphQL API
Can you please provide more info on how to use that API? How does Github allow us to access it?
Thanks for clarifying. I hold my answer since I didn't know anything about this graphql.
Today I could find this demo by github which I could run graphql queries on.
I worked on it to get a complete output of what I want.
query {
repository(owner: "pourmand1376", name: "hugo-papermod-farsi-template") {
discussions(first: 10) {
# type: DiscussionConnection
totalCount # Int!
nodes {
# type: Discussion
url
updatedAt
title
comments(last:2)
{
totalCount
nodes {
author {
login
url
}
url
}
}
}
}
}
}
This is the query which works for me. I think I will combine it with this stackoverflow post to make what I want.
I left a comment here so that anyone interested would know that this is possible. I will update this comment to make it more complete if I finish this thing completely.
sry, I completely forgot about this issue. In fact, I created a JS script and hosted it on Vercel to implement this functionality three months ago. you can check out my repository: https://github.com/weekdaycare/discussion-new-api
It will provide JSON data, which you can use to write the frontend display code.
Thanks for providing more info.
Yesterday, I also put in some time and implemented it here.
https://github.com/pourmand1376/python-github-action-template
It is a script which reads discussion's data and puts it in a html file which I read in my website loading page.
Similar like yours.
Oh, it looks like you are using actions to schedule scraping discussion data and convert it into HTML. I've encapsulated it into an API and styled the HTML on the frontend. The advantage is that it can display new comments in real-time, but the downside is the connectivity issue with Vercel in different regions.
However, I have switched from Giscus to Twikoo now. This script is something I wrote for a blog friend🫠.
Hi.
First, I want to thank you for creating this beautiful commenting system. It's been a year or two since I'm using your comment system.
Now, I want to add a feature to it and I don't know where to start. I want to have a page / Section where it shows the latest comments in my blog. Pretty much like this one but without excerpt. Only showing the 10 latest comments in my blog.
How can I add this to my blog? I've seen this in lots of wordpress websites and I think this is needed in my blog.