Skip to content

Commit

Permalink
版权信息
Browse files Browse the repository at this point in the history
  • Loading branch information
D-Sketon committed Jun 1, 2024
1 parent 04b17f9 commit 9344543
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 14 deletions.
22 changes: 16 additions & 6 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ avatar: "avatar.webp" # source/_data/avatar/avatar.webp
excerpt_link: Read More
fancybox: true

# rss
# RSS
# need https://github.com/hexojs/hexo-generator-feed
rss: atom.xml

Expand All @@ -26,15 +26,25 @@ baidu_analytics: false
google_analytics: false
clarity: false

# Footer
# Footer copyright
copyright:
# Need help choosing? Please see...
# https://creativecommons.org/choose/
# https://choosealicense.com/
# You can use html like below...
# You can use pug like below...
# copyright: |-
# <a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a></br>
# All website licensed under <a href="https://creativecommons.org/licenses/by/4.0/" target="_blank">CC BY 4.0</a></br>
# <div style="flex-direction:column;align-items: center;"><a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a>
# All website licensed under <a href="https://creativecommons.org/licenses/by/4.0/" target="_blank">CC BY 4.0</a></div>

article_copyright:
enable: false
content:
author: true
link: true
title: false
date: false
updated: false
license: true

# Sidebar
sidebar: right
Expand Down Expand Up @@ -241,7 +251,7 @@ live2d:

reimu_cursor: true

icon_font: 4552607_mss8pw3adzo
icon_font: 4552607_09mhdxci6yrk

# Dependent cdn links
vendor:
Expand Down
1 change: 1 addition & 0 deletions layout/_partial/article.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<% } %>
</div>
<footer class="article-footer">
<%- articleCopyright(post) %>
<a data-url="<%- post.permalink %>" data-id="<%= post._id %>" data-title="<%= post.title %>" class="article-share-link"><%= __('share') %></a>
<% if (post.comments !== false && theme.valine.enable && theme.valine.appId && theme.valine.appKey) { %>
<a href="<%- url_for(post.path) %>#comments" class="article-comment-link">
Expand Down
23 changes: 23 additions & 0 deletions scripts/helper/articleCopyright.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
hexo.extend.helper.register("articleCopyright", (post) => {
const authorDom = `<p><strong>本文作者:</strong>${hexo.config.author} @ ${hexo.config.title}</p>`;
const linkDom = `<p><strong>本文链接:</strong><a href="${post.permalink}">${post.permalink}</a></p>`;
const titleDom = `<p><strong>本文标题:</strong>${post.title}</p>`;
const dateDom = `<p><strong>本文发布时间:</strong>${post.date.format(
"YYYY-MM-DD HH:mm:ss"
)}</p>`;
const updatedDom = `<p><strong>本文修改时间:</strong>${post.updated.format(
"YYYY-MM-DD HH:mm:ss"
)}</p>`;
const licenseDom = `<p><strong>本文版权:</strong>本博客所有文章除特别声明外,均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh"><span class="icon-creative-commons"></span>BY-NC-SA</a> 许可协议。转载请注明出处!</p>`;
if (!hexo.theme.config.article_copyright.enable) return "";
const { author, link, title, date, updated, license } =
hexo.theme.config.article_copyright.content;
return `<blockquote class="article-copyright">
${author ? authorDom : ""}
${link ? linkDom : ""}
${title ? titleDom : ""}
${date ? dateDom : ""}
${updated ? updatedDom : ""}
${license ? licenseDom : ""}
</blockquote>`;
});
4 changes: 2 additions & 2 deletions scripts/util/checkVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ hexo.on("generateAfter", () => {
);
}
} catch (err) {
hexo.log.error("Failed to detect version info. Error message:");
hexo.log.error(err);
hexo.log.warn("Failed to detect version info. Error message:");
hexo.log.warn(err);
}
});
}
Expand Down
8 changes: 4 additions & 4 deletions source/css/_partial/card.styl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
height: 66px
width: 68px
padding-right: 20px
flex-shrink: 0

img
width: 100%
Expand Down Expand Up @@ -65,6 +66,7 @@
width: 100%
justify-content: center
height: 66px
overflow: hidden

.post-link-card-title
font-size: 18px
Expand All @@ -81,11 +83,9 @@
color: var(--color-grey)
padding: 5px 0
text-overflow: ellipsis
-webkit-line-clamp: 2
display: -webkit-box
-webkit-box-orient: vertical
width: 100%
white-space: nowrap
overflow: hidden
width: 100%

.icon-link
font-size: 12px
Expand Down
23 changes: 23 additions & 0 deletions source/css/_partial/footer.styl
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,26 @@
@keyframes transform-all
100%
transform: translateX(-100px)

.article-copyright
background: var(--red-5-5)
border-left: 6px var(--red-4) solid
margin: 1.8em 0
border-radius: 5px
transition: all .3s ease
padding: 5px 10px

p
font-size: 14px;
line-height: 2;
color: var(--color-default)

strong
font-weight: 700

a
color: var(--color-default)
text-decoration: none

&:hover
text-decoration: underline
7 changes: 6 additions & 1 deletion source/css/fontawesome.styl
Original file line number Diff line number Diff line change
Expand Up @@ -292,4 +292,9 @@ font-icon = "Font Awesome 6 Free", "Font Awesome 6 Brands", "Font Awesome 5 Free
.icon-globe
&:before
font-family: font-icon
content: "\f0ac"
content: "\f0ac"

.icon-creative-commons
&:before
font-family: font-icon
content: "\f25e"
7 changes: 6 additions & 1 deletion source/css/iconfont.styl
Original file line number Diff line number Diff line change
Expand Up @@ -303,4 +303,9 @@ _c = '//at.alicdn.com/t/c/font_' + id + '.ttf'
.icon-globe
&:before
font-family: font-icon
content: "\e638"
content: "\e638"

.icon-creative-commons
&:before
font-family: font-icon
content: "\e63a"

0 comments on commit 9344543

Please sign in to comment.