Skip to content

Commit

Permalink
Merge pull request #121 from tuchg/master
Browse files Browse the repository at this point in the history
add  some custom options & update gitalk and add 2 options
  • Loading branch information
cofess authored Jan 3, 2022
2 parents 348dab7 + 16fec76 commit 6977eb7
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 8 deletions.
7 changes: 7 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ config:
menu_highlight: false # 是否开启当前菜单高亮显示
thumbnail: false # enable posts thumbnail, options: true, false
excerpt_link: Read More
#New
isNewTabLinks: false #是否链接打开新标签页
autoUnfold: true # 默认展开文章目录

# Pagination
pagination:
Expand Down Expand Up @@ -128,6 +131,9 @@ comment:
repo: #必须. GitHub repository.
ClientID: #必须. GitHub Application Client ID.
ClientSecret: #必须. GitHub Application Client Secret.
enableHotKey: true
language: zh-CN

valine: # Valine. https://valine.js.org
appid: # your leancloud application appid
appkey: # your leancloud application appkey
Expand Down Expand Up @@ -187,6 +193,7 @@ fb_app_id:
# profile
profile:
enabled: true # Whether to show profile bar
articleSelfBlock: false # 关闭文章下方的自我介绍
avatar: images/avatar.jpg
gravatar: # Gravatar email address, if you enable Gravatar, your avatar config will be overriden
author: 昵称
Expand Down
4 changes: 2 additions & 2 deletions layout/_partial/item-post.ejs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% if (type == 'link'){ %>
<a href="<%- url_for(post.path) %>" class="collection-item" target="_blank" itemprop="url">
<a href="<%- url_for(post.path) %>" class="collection-item" <% if (theme.config.isNewTabLinks){ %> target="_blank" <%}%> itemprop="url">
<time datetime="<%= date_xml(post.date) %>" itemprop="datePublished"><%= date(post.date) %></time>
<span>&nbsp;&nbsp;&nbsp;</span> <%= post.title %>
</a>
Expand All @@ -25,7 +25,7 @@
<% } %>
</article>
<% } else { %>
<a href="<%- url_for(post.path) %>" class="collection-item" target="_blank" itemprop="url">
<a href="<%- url_for(post.path) %>" class="collection-item" <% if (theme.config.isNewTabLinks){ %> target="_blank" <%}%> itemprop="url">
<time datetime="<%= date_xml(post.date) %>" itemprop="datePublished"><%= date(post.date) %></time>
<span>&nbsp;&nbsp;&nbsp;</span> <%= post.title %>
</a>
Expand Down
3 changes: 1 addition & 2 deletions layout/_partial/post/nav.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
<% } %>
<% if (!index && theme.config.toc && post.toc) { %>
<li class="toggle-toc">
<a class="toggle-btn collapsed" data-toggle="collapse" href="#collapseToc" aria-expanded="false" title="<%= __('article.catalogue') %>" role="button">
<span>[&nbsp;</span><span><%= __('article.catalogue') %></span>
<a class="toggle-btn <% if(!theme.config.autoUnfold){%> collapsed <%}%>" data-toggle="collapse" href="#collapseToc" aria-expanded="false" title="<%= __('article.catalogue') %>" role="button"> <span>[&nbsp;</span><span><%= __('article.catalogue') %></span>
<i class="text-collapsed icon icon-anchor"></i>
<i class="text-in icon icon-close"></i>
<span>]</span>
Expand Down
2 changes: 1 addition & 1 deletion layout/_partial/sidebar-toc.ejs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% if (!index && theme.config.toc && post.toc) { %>
<aside class="sidebar sidebar-toc collapse" id="collapseToc" itemscope itemtype="http://schema.org/WPSideBar">
<aside class="sidebar sidebar-toc collapse <% if(theme.config.autoUnfold){%> in <%}%>" id="collapseToc" itemscope itemtype="http://schema.org/WPSideBar">
<div class="slimContent">
<nav id="toc" class="article-toc">
<h3 class="toc-title"><%= __('article.catalogue') %></h3>
Expand Down
8 changes: 5 additions & 3 deletions layout/_script/_comment/gitalk.ejs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<% if (typeof(script) !== 'undefined' && script) { %>
<!-- <link rel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css"> -->
<script src="//cdn.jsdelivr.net/npm/gitalk@1.4.0/dist/gitalk.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/gitalk@1.6.2/dist/gitalk.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/[email protected]/js/md5.min.js"></script>
<script type="text/javascript">
var gitalk = new Gitalk({
Expand All @@ -10,8 +10,10 @@
owner: '<%= theme.comment.gitalk.owner %>',
admin: ['<%= theme.comment.gitalk.admin %>'],
id: md5(location.pathname),
distractionFreeMode: true
distractionFreeMode: true,
language: '<%= theme.comment.gitalk.language %>',
enableHotKey: '<%= theme.comment.gitalk.enableHotKey %>'
})
gitalk.render('comments')
</script>
<% } %>
<% } %>
5 changes: 5 additions & 0 deletions source/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -7895,6 +7895,11 @@ body.okayNav-loaded {
}

@media (min-width: 992px) {

.slimContent{
margin-top: 20px;
}

.container {
width: 970px;
}
Expand Down

0 comments on commit 6977eb7

Please sign in to comment.