-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1436 from tangly1024/feat/comment-artalk
支持Artalk评论插件
- Loading branch information
Showing
4 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import BLOG from '@/blog.config' | ||
import { loadExternalResource } from '@/lib/utils' | ||
// import { loadExternalResource } from '@/lib/utils' | ||
import { useEffect } from 'react' | ||
|
||
/** | ||
* Giscus评论 @see https://giscus.app/zh-CN | ||
* Contribute by @txs https://github.com/txs/NotionNext/commit/1bf7179d0af21fb433e4c7773504f244998678cb | ||
* @returns {JSX.Element} | ||
* @constructor | ||
*/ | ||
|
||
const Artalk = ({ siteInfo }) => { | ||
useEffect(() => { | ||
loadExternalResource(BLOG.COMMENT_ARTALK_CSS, 'css') | ||
window?.Artalk?.init({ | ||
server: BLOG.COMMENT_ARTALK_SERVER, // 后端地址 | ||
el: '#artalk', // 容器元素 | ||
locale: BLOG.LANG, | ||
// pageKey: '/post/1', // 固定链接 (留空自动获取) | ||
// pageTitle: '关于引入 Artalk 的这档子事', // 页面标题 (留空自动获取) | ||
site: siteInfo?.title // 你的站点名 | ||
}) | ||
}, []) | ||
return ( | ||
<div id="artalk"></div> | ||
) | ||
} | ||
|
||
export default Artalk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters