Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
大白技术控
yanglr2010
提交
0cf4db14
Y
yanglr2010
项目概览
大白技术控
/
yanglr2010
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
yanglr2010
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
0cf4db14
编写于
7月 13, 2019
作者:
EvanOne(文一)
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: Add gitalk comment
上级
34703e5c
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
62 addition
and
2 deletion
+62
-2
_config.yml
_config.yml
+24
-0
layout/_components/comments.pug
layout/_components/comments.pug
+3
-0
layout/_third-party/comments/gitalk.pug
layout/_third-party/comments/gitalk.pug
+24
-0
layout/_third-party/comments/index.pug
layout/_third-party/comments/index.pug
+3
-1
layout/_third-party/search/algolia.pug
layout/_third-party/search/algolia.pug
+1
-1
source/css/_components/comments.styl
source/css/_components/comments.styl
+7
-0
未找到文件。
_config.yml
浏览文件 @
0cf4db14
...
...
@@ -348,11 +348,35 @@ gitment:
owner
:
# Github repository.
repo
:
# Github Application Client ID
client_id
:
# Github Application Client Secret
client_secret
:
# Enable / Disable Lazy load. Enable is recommended.
lazy
:
true
# Gittalk
# See: https://github.com/gitalk/gitalk
gitalk
:
enable
:
false
# Github username.
owner
:
# Github repository.
repo
:
# Github Application Client ID
client_id
:
# Github Application Client Secret
client_secret
:
# GitHub repo owner and collaborators, only these guys can initialize github issues
admin
:
# Facebook-like distraction free mode
distraction_free_mode
:
false
# Gitalk's display language depends on user's browser or system environment
# If you want everyone visiting your site to see a uniform language,
# you can set a force language value
# Available values: en, zh-CN, es-ES, fr, ru, zh-TW
language
:
# ---------------------------------------------------------------
# Statistics and Analytics config
# ---------------------------------------------------------------
...
...
layout/_components/comments.pug
浏览文件 @
0cf4db14
...
...
@@ -6,3 +6,6 @@ if theme.gitment && theme.gitment.enable
div#gitment-container(style="display: none")
else
div#gitment-container
else if theme.gitalk && theme.gitalk.enable
div#comments.comments.main-content-layout
div#gitalk-container
layout/_third-party/comments/gitalk.pug
0 → 100644
浏览文件 @
0cf4db14
link(href="https://cdn.jsdelivr.net/npm/gitalk@latest/dist/gitalk.min.css" rel="stylesheet" type="text/css")
script(src="https://cdn.jsdelivr.net/npm/gitalk@latest/dist/gitalk.min.js")
script(src="https://cdn.jsdelivr.net/npm/js-md5@latest/src/md5.min.js")
-
let lang = _.get(theme, 'gitalk.language')
? theme.gitalk.language : (config.language
? config.language : (window.navigator.language ||
window.navigator.userLanguage));
script.
window.onload = function () {
let gitalk = new Gitalk({
id: md5(decodeURI(location.pathname)),
clientID: '!{ theme.gitalk.client_id }',
clientSecret: '!{ theme.gitalk.client_secret }',
repo: '!{ theme.gitalk.repo }',
owner: '!{ theme.gitalk.owner }',
admin: ['!{ theme.gitalk.admin }'],
distractionFreeMode: '!{ theme.gitalk.distraction_free_mode }',
language: '!{ lang }'
});
gitalk.render('gitalk-container');
};
layout/_third-party/comments/index.pug
浏览文件 @
0cf4db14
if page.comments
if
theme.gitment.enable && theme.gitment.client_id && theme.gitment.client_secret
if
theme.gitment && theme.gitment.enable
include ./gitment.pug
else if theme.gitalk && theme.gitalk.enable
include ./gitalk.pug
layout/_third-party/search/algolia.pug
浏览文件 @
0cf4db14
link(rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/instantsearch.js@2.1.1/dist/instantsearch.min.css")
script(
src="https://cdn.jsdelivr.net/npm/instantsearch.js@2.1.1/dist/instantsearch.min.js" defer
)
script(
defer src="https://cdn.jsdelivr.net/npm/instantsearch.js@2.1.1/dist/instantsearch.min.js"
)
source/css/_components/comments.styl
浏览文件 @
0cf4db14
...
...
@@ -24,3 +24,10 @@
a.gitment-editor-avatar
clearAStyle()
// Gitalk
#gitalk-container
width: 100%
& > :first-child
margin: 0 auto
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录