Skip to content

Commit

Permalink
Merge pull request iissnan#1497 from Jacksgong/post-copyright
Browse files Browse the repository at this point in the history
feat: add the configure for declare copyright on posts
  • Loading branch information
iissnan authored Mar 13, 2017
2 parents 3cf9c83 + 3984631 commit 38f6b7a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ authoricon: heart
# Footer `powered-by` and `theme-info` copyright
copyright: true

# Declare license on posts
post_copyright:
enable: false
license: CC BY-NC-SA 3.0 CN
license_url: http://creativecommons.org/licenses/by-nc-sa/3.0/cn/


# Canonical, set a canonical link tag in your hexo, you could use it for your SEO of blog.
# See: https://support.google.com/webmasters/answer/139066
# Tips: Before you open this tag, remember set up your URL in hexo _config.yml ( ex. url: http://yourdomain.com )
Expand Down
7 changes: 7 additions & 0 deletions layout/_macro/post-copyright.swig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% if theme.post_copyright.enable %}
<div style="background-color: #f9f9f9; margin-top: 2em; border-left:3px solid #ff1700; padding:.5em 1em;">
<strong>本文链接:</strong> <a href="{{ config.url }}{{ url_for(path) }}" title="{{ title }}">{{ config.url }}{{ url_for(path) }}</a>
<br>
<strong>版权声明:</strong>本博客所有文章除特别声明外,均采用<a href="{{ theme.post_copyright.license_url }}" rel="external nofollow" target="_blank">{{ theme.post_copyright.license }}</a>许可协议。转载请注明出处!<br>
</div>
{% endif %}
5 changes: 5 additions & 0 deletions layout/_macro/post.swig
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,11 @@
{% endif %}
</div>

<div>
{% if not is_index %}
{% include 'post-copyright.swig' %}
{% endif %}
</div>

<footer class="post-footer">
{% if post.tags and post.tags.length and not is_index %}
Expand Down

0 comments on commit 38f6b7a

Please sign in to comment.