Skip to content
This repository has been archived by the owner on Jun 4, 2022. It is now read-only.

Commit

Permalink
Merge pull request #26 from charsdavy/master
Browse files Browse the repository at this point in the history
添加多说评论和about页面,详见说明
  • Loading branch information
ppoffice authored Aug 6, 2016
2 parents 8bfd2e0 + a1d061a commit 1d5c846
Show file tree
Hide file tree
Showing 9 changed files with 113 additions and 5 deletions.
Binary file added .DS_Store
Binary file not shown.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ menu:
Categories: categories
Tags: tags
About: about
Rss: /atom.xml
# Content
excerpt_link: Read More
Expand All @@ -45,6 +46,10 @@ fancybox: true
# Miscellaneous
google_analytics:
favicon: /favicon.png
# Share
share_jia: false
share_addthis: true
```

- **excerpt_link** - Cooperate with <!-- more --\> tag to show only part of the article in index pages.
Expand All @@ -55,15 +60,16 @@ favicon: /favicon.png

Don't forget to rename `_config.yml.example` to `_config.yml` to enable theme config!

## Custom Categories & Tags Pages
## Custom Categories & Tags & About Pages

To enable custom categories page and tags page, just copy the `categories` folder and `tags` folder under your theme's `_source` foler into your site's `source` folder. Then edit theme's _config.yml and add the following lines:
To enable custom categories page, tags page and about page, just copy the `categories` folder, `tags` folder and `about` folder under your theme's `_source` foler into your site's `source` folder. Then edit theme's _config.yml and add the following lines:
```
# Header
menu:
...
Categories: categories # -> add this line
Tags: tags # -> and add this line
About: about # -> and add this line
...
```

Expand Down
7 changes: 6 additions & 1 deletion _config.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ menu:
Categories: categories
Tags: tags
About: about
Rss: /atom.xml

# Content
excerpt_link: Read More
Expand All @@ -14,4 +15,8 @@ fancybox: true

# Miscellaneous
google_analytics:
favicon: /favicon.png
favicon: /favicon.png

# Share
share_jia: false
share_addthis: true
5 changes: 5 additions & 0 deletions _source/about/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
title: ""
layout: "about"
---

<!--使用markdown填写自己的about信息-->
36 changes: 36 additions & 0 deletions layout/_partial/about-page.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<article id="<%= post.layout %>-<%= post.slug %>" class="article article-type-<%= post.layout %>" itemscope itemprop="blogPost">
<div class="article-inner">
<%- partial('post/gallery') %>
<% if (post.link || post.title){ %>
<header class="article-header">
<%- partial('post/title', {class_name: 'article-title'}) %>
</header>
<% } %>
<div class="article-entry" itemprop="articleBody">
<% if (post.excerpt && index){ %>
<%- post.excerpt %>
<% if (theme.excerpt_link){ %>
<p class="article-more-link">
<a href="<%- url_for(post.path) %>#more"><%= theme.excerpt_link %></a>
</p>
<% } %>
<% } else { %>
<%- post.content %>
<% } %>
</div>
<% if (!index && theme.toc && toc(post.content)) { %>
<div class="article-toc">
<h3><%= __('article.contents') %></h3>
<%- toc(post.content) %>
</div>
<% } %>
<% if (!index || post.tags.length){ %>
<footer class="article-footer">
<%- partial('post/tag') %>
</footer>
<% } %>
</div>
<% if (!index){ %>
<%- partial('post/nav') %>
<% } %>
</article>
33 changes: 31 additions & 2 deletions layout/_partial/article.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
<div class="article-meta">
<%- partial('post/date', {class_name: 'article-date', date_format: null}) %>
<%- partial('post/category') %>
<% if (post.comments && config.disqus_shortname){ %>
<% if (post.comments && config.duoshuo_shortname){ %>
<div class="article-comment-link-wrap">
<a href="<%- post.permalink %>#disqus_thread" class="article-comment-link"><%= __('article.comments') %></a>
<a href="<%- post.permalink %>#ds-thread" class="article-comment-link"><%= __('article.comments') %></a>
</div>
<% } %>
</div>
Expand Down Expand Up @@ -44,10 +44,39 @@
<% } %>
</article>

<% if (!index && theme.share_jia){ %>
<%- partial('post/share_jia') %>
<% } %>

<% if (!index && theme.share_addthis){ %>
<%- partial('post/share_addthis') %>
<% } %>

<% if (!index && post.comments && config.disqus_shortname){ %>
<section id="comments">
<div id="disqus_thread">
<noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>
</section>
<% } %>

<% if (!index && post.comments && config.duoshuo_shortname){ %>
<section id="comments">
<!-- 多说评论框 start -->
<div class="ds-thread" data-thread-key="<%= post.layout %>-<%= post.slug %>" data-title="<%= post.title %>" data-url="<%= page.permalink %>"></div>
<!-- 多说评论框 end -->
<!-- 多说公共JS代码 start (一个网页只需插入一次) -->
<script type="text/javascript">
var duoshuoQuery = {short_name:'<%= config.duoshuo_shortname %>'};
(function() {
var ds = document.createElement('script');
ds.type = 'text/javascript';ds.async = true;
ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
ds.charset = 'UTF-8';
(document.getElementsByTagName('head')[0]
|| document.getElementsByTagName('body')[0]).appendChild(ds);
})();
</script>
<!-- 多说公共JS代码 end -->
</section>
<% } %>
9 changes: 9 additions & 0 deletions layout/_partial/post/share_addthis.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div class="share_addthis">
<div class="sharing addthis_toolbox share">
<a class="addthis_button_facebook_like"></a>
<a class="addthis_button_tweet"></a>
<a class="addthis_button_google_plusone" g:plusone:size="medium"></a>
<a class="addthis_counter addthis_pill_style"></a>
</div>
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-560c64c35486b3d4" async="async"></script>
</div>
17 changes: 17 additions & 0 deletions layout/_partial/post/share_jia.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<div class="share_jia">
<!-- JiaThis Button BEGIN -->
<div class="jiathis_style">
<span class="jiathis_txt"><%= __('post.share') %>: &nbsp; </span>
<a class="jiathis_button_facebook"></a>
<a class="jiathis_button_twitter"></a>
<a class="jiathis_button_plus"></a>
<a class="jiathis_button_tsina"></a>
<a class="jiathis_button_cqq"></a>
<a class="jiathis_button_douban"></a>
<a class="jiathis_button_weixin"></a>
<a class="jiathis_button_tumblr"></a>
<a href="http://www.jiathis.com/share" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
</div>
<script type="text/javascript" src="http://v3.jiathis.com/code/jia.js?uid=1405949716054953" charset="utf-8"></script>
<!-- JiaThis Button END -->
</div>
1 change: 1 addition & 0 deletions layout/about.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%- partial('_partial/about-page', {post: page, index: false}) %>

0 comments on commit 1d5c846

Please sign in to comment.