Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add the configure for declare copyright on posts #1497

Merged
merged 2 commits into from
Mar 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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