31 lines
1.2 KiB
Plaintext
31 lines
1.2 KiB
Plaintext
<script>
|
|
window.themeConfig = {
|
|
isHome: <%=is_home()%>, // 是否为首页
|
|
isPost: <%=is_post()%>, // 是否为文章全文页面
|
|
isArchive: <%=is_archive()%>, // 是否为归档页面
|
|
isTag: <%=is_tag()%>, // 是否为标签页面
|
|
isCategory: <%=is_category()%>, // 是否为分类页面
|
|
pageid: <%-page.pageid ? `"${page.pageid}"` : 'undefined'%>, // 页面标识, 用于个性化页面开发
|
|
toc_hide_index: <%=theme.toc_hide_index%>, // 目录序号
|
|
root: "<%=config.root%>", // 资源根路径
|
|
pictureCdn: "<%=config.picture_cdn%>" // 图片存储仓库地址
|
|
}
|
|
</script>
|
|
<%- partial('script') %>
|
|
<% if(theme.gitalk.enable && is_post()) { %>
|
|
<link rel="stylesheet" type="text/css" href="https://unpkg.com/gitalk/dist/gitalk.css">
|
|
<script src="https://unpkg.com/gitalk/dist/gitalk.min.js"></script>
|
|
<script>
|
|
(function(Gitalk){
|
|
new Gitalk({
|
|
clientID: '<%=theme.gitalk.ClientID%>',
|
|
clientSecret: '<%=theme.gitalk.ClientSecret%>',
|
|
repo: '<%=theme.gitalk.repo%>',
|
|
owner: '<%=theme.gitalk.githubID%>',
|
|
admin: ['<%=theme.gitalk.adminUser%>'],
|
|
id: decodeURI(location.pathname),
|
|
distractionFreeMode: <%=theme.gitalk.distractionFreeMode%>
|
|
}).render('comments')
|
|
})(Gitalk)
|
|
</script>
|
|
<% } %> |