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

能否在博客主页侧边栏显示近期评论 #322

Open
Achuan-2 opened this issue Sep 27, 2023 · 7 comments
Open

能否在博客主页侧边栏显示近期评论 #322

Achuan-2 opened this issue Sep 27, 2023 · 7 comments

Comments

@Achuan-2
Copy link
Contributor

image

@Achuan-2 Achuan-2 changed the title 能否在博客主页显示近期评论 能否在博客主页侧边栏显示近期评论 Sep 27, 2023
@ThatCoders
Copy link
Contributor

每个评论插件都不同,你可以自定义一个侧边栏组件,调用自己评论插件的api即可

@Achuan-2
Copy link
Contributor Author

每个评论插件都不同,你可以自定义一个侧边栏组件,调用自己评论插件的api即可

貌似 giscus 没有近期评论api

@ThatCoders
Copy link
Contributor

每个评论插件都不同,你可以自定义一个侧边栏组件,调用自己评论插件的api即可

貌似 giscus 没有近期评论api

中秋没带电脑,Gsicus应该是利用GitHub Discussions,去你的discuss设置成按时间排序,用浏览器开发者工具抓一下排序后的GitHub的官方api就行

@xaoxuu
Copy link
Owner

xaoxuu commented Dec 14, 2023

只要有数据就好办,用timeline组件来显示,beaudar我之前就用过,别的不太清楚。

@lei-cau
Copy link

lei-cau commented Jan 29, 2024

大佬们好,这是twikoo官方的近期评论代码,请问有方法把它集成到侧边栏吗(小白真心求教)
twikoo.getRecentComments({
envId: '您的环境id', // 环境 ID
// region: 'ap-guangzhou', // 环境地域,默认为 ap-shanghai,如果您的环境地域不是上海,需传此参数
urls: [ // 要求云函数版本 >= 1.6.27。不包含协议、域名、参数的文章路径列表,不传默认获取所有最新评论
'/2020/10/post-1.html',
'/2020/11/post-2.html',
'/2020/12/post-3.html'
],
pageSize: 10, // 获取多少条,默认:10,最大:100
includeReply: false // 是否包括最新回复,默认:false
}).then(function (res) {
console.log(res);
// 返回 Array,包含最新评论的
// * id: 评论 ID
// * url: 评论地址
// * nick: 昵称
// * mailMd5: 邮箱的 MD5 值,可用于展示头像
// * link: 网址
// * comment: HTML 格式的评论内容
// * commentText: 纯文本格式的评论内容
// * created: 评论时间,格式为毫秒级时间戳
// * avatar: 头像地址(0.2.9 新增)
// * relativeTime: 相对评论时间,如 “1 小时前”(0.2.9 新增)
// 返回示例: [ // 从新到旧顺序
// { id: '', url: '', nick: '', mailMd5: '', link: '', comment: '', commentText: '', created: 0 },
// { id: '', url: '', nick: '', mailMd5: '', link: '', comment: '', commentText: '', created: 0 },
// { id: '', url: '', nick: '', mailMd5: '', link: '', comment: '', commentText: '', created: 0 }
// ]
}).catch(function (err) {
// 发生错误
console.error(err);
});

@xaoxuu
Copy link
Owner

xaoxuu commented Jan 30, 2024

https://blog.thatcoder.cn 这位大佬有改造过的万能时间线,应该能直接用

@lei-cau
Copy link

lei-cau commented Jan 30, 2024

谢谢 大佬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants