i18n
xaoxuu 5 years ago
parent 504cef8452
commit 7ff99a7abd
  1. 7
      _config.yml
  2. 8
      layout/_meta/author.ejs
  3. 16
      layout/_meta/categories.ejs
  4. 12
      layout/_meta/counter.ejs
  5. 6
      layout/_meta/date.ejs
  6. 6
      layout/_meta/music.ejs
  7. 3
      layout/_meta/share.ejs
  8. 9
      layout/_meta/tags.ejs
  9. 3
      layout/_meta/thumbnail.ejs
  10. 11
      layout/_meta/title.ejs
  11. 8
      layout/_meta/topping.ejs
  12. 6
      layout/_meta/updated.ejs
  13. 156
      layout/_partial/article.ejs
  14. 138
      layout/_partial/meta.ejs
  15. 2
      layout/_partial/post.ejs
  16. 2
      layout/_partial/side.ejs
  17. 54
      layout/_third-party/share.ejs
  18. 3
      layout/links.ejs

@ -102,6 +102,13 @@ menu_mobile:
icon: fas fa-info-circle
url: about/
# 默认的meta信息,文章中没有配置则按照这里的配置来显示,设置为false则不显示
# 其中,title只在top中有效,music和thumbnail无需在这里设置,文章中有则显示
# 如果tags放置在meta.header中,那么在post列表中不显示(因为卡片下方已经有了)
meta:
header: [title, author, date, categories, counter]
footer: [updated, tags, share]
# 侧边栏小部件,默认按下面给定的顺序全部显示,文章中还可以自定义显示一部分以及顺序
sidebar:

@ -0,0 +1,8 @@
<% if(post.author || config.author){ %>
<div class='new-meta-item author'>
<a href="<%- url_for(config.url) %>">
<i class="fas fa-user" aria-hidden="true"></i>
<%- post.author || config.author %>
</a>
</div>
<% } %>

@ -0,0 +1,16 @@
<% if (post.categories && post.categories.length && post.categories.forEach){ %>
<%
var cats = [];
var path;
post.categories.forEach(function(cat){
cats.push(cat.name);
path = cat.path;
});
%>
<div class='new-meta-item category'>
<a href='<%- url_for(path) %>'>
<i class="fas fa-folder-open" aria-hidden="true"></i>
<%- cats.join('&nbsp;/&nbsp;') %>
</a>
</div>
<% } %>

@ -0,0 +1,12 @@
<% if(!isPostList){ %>
<% if (theme.busuanzi == true) { %>
<div class="new-meta-item browse busuanzi">
<a class='notlink'>
<i class="fas fa-eye" aria-hidden="true"></i>
<span id="busuanzi_value_page_pv">
<i class="fas fa-spinner fa-spin fa-fw" aria-hidden="true"></i>
</span>
</a>
</div>
<% } %>
<% } %>

@ -0,0 +1,6 @@
<div class="new-meta-item date">
<a class='notlink'>
<i class="fas fa-calendar-alt" aria-hidden="true"></i>
<%= date(post.date, theme.date_format) %>
</a>
</div>

@ -0,0 +1,6 @@
<% if(post.music && post.music.enable != false){ %>
<%- partial('../_third-party/aplayer',
{aplayer_theme: '', aplayer_mini: true, aplayer_mode: 'circulation',
aplayer_server: post.music.server, aplayer_type: post.music.type, aplayer_id: post.music.id,
aplayer_volume: post.music.volume?post.music.volume:'0.7', aplayer_autoplay: post.music.autoplay?true:false }) %>
<% } %>

@ -0,0 +1,3 @@
<% if (theme.share) { %>
<%- partial('../_third-party/share') %>
<% } %>

@ -0,0 +1,9 @@
<% if (!isPostList && post.tags && post.tags.length) { %>
<%
var items = [];
post.tags.each(function(item){
items.push('<div class="new-meta-item meta-tags"><a class="tag" href="'+url_for(item.path)+'"><i class="fas fa-hashtag" aria-hidden="true"></i>&nbsp;' + item.name + '</a></div>');
});
%>
<%- items.join(' ') %>
<% } %>

@ -0,0 +1,3 @@
<% if(post.thumbnail && post.thumbnail.length){ %>
<a title='<%- post.title %>' href='<%- url_for(post.path) %>'><img class='thumbnail' src='<%- post.thumbnail %>'></a>
<% } %>

@ -0,0 +1,11 @@
<% if(isPostList){ %>
<h2 class="title">
<a href="<%- url_for(post.path) %>">
<%- post.title ? post.title : date(post.date, theme.date_format) %>
</a>
</h2>
<% } else { %>
<% if (post.title || page.title || config.title) { %>
<h1 class="title"><%- post.title ? post.title : date(post.date, theme.date_format) %></h1>
<% } %>
<% } %>

@ -0,0 +1,8 @@
<% if(isPostList && post.top){ %>
<div class="new-meta-item top-post">
<a class='notlink'>
<i class="fas fa-angle-double-up" aria-hidden="true"></i>
<%- post.top != true ? post.top : __('post.top') %>
</a>
</div>
<% } %>

@ -0,0 +1,6 @@
<div class="new-meta-item date" itemprop="dateUpdated" datetime="<%- moment(post.updated).format() %>">
<a class='notlink'>
<i class="fas fa-save" aria-hidden="true"></i>
<%- __('post.updated') + ' ' + date(post.updated, theme.updated_date_format) %>
</a>
</div>

@ -1,98 +1,72 @@
<article id="<%= post.layout %>" class="post white-box article-type-<%= post.layout %>" itemscope itemprop="blogPost">
<%- partial('meta',{post:post}) %>
<section class="article typo">
<div class="article-entry" itemprop="articleBody">
<%- post.content %>
</div>
<% if(post.layout == 'post'){ %>
<section class='meta' id="footer-meta">
<hr>
<div class='new-meta-box'>
<% if(!page.meta || page.meta.updated != false){ %>
<div class="new-meta-item date" itemprop="dateUpdated" datetime="<%- moment(post.updated).format() %>">
<a class='notlink'>
<i class="fas fa-save" aria-hidden="true"></i>
<%- __('post.updated') + ' ' + date(post.updated, theme.updated_date_format) %>
</a>
</div>
<%- partial('meta', {post: post, position: 'header'}) %>
<section class="article typo">
<div class="article-entry" itemprop="articleBody">
<%- post.content %>
</div>
<% if(post.layout == 'post'){ %>
<%- partial('meta', {post: post, position: 'footer'}) %>
<% } %>
<% if(post.prev || post.next){ %>
<div class="prev-next">
<% if(post.prev){ %>
<section class="prev">
<span class="art-item-left">
<h6><i class="fas fa-chevron-left" aria-hidden="true"></i>&nbsp;<%- __('post.prev_page') %></h6>
<h4>
<a href="<%=url_for(post.prev.path)%>" rel="prev" title="<%=post.prev.title%>">
<% if(post.prev.title){ %>
<%= post.prev.title %>
<% } else if (post.prev.date) { %>
<%= date(post.prev.date, config.date_format) %>
<% } %>
</a>
</h4>
<% if (post.prev.tags && post.prev.tags.length && post.prev.tags.each) { %>
<%
var items = [];
post.prev.tags.each(function(item){
items.push('<a class="tag" href="'+url_for(item.path)+'"><i class="fas fa-hashtag fa-fw" aria-hidden="true"></i>' + item.name + '</a>');
});
%>
<h6 class="tags">
<%- items.join(' ') %>
</h6>
<% } %>
</span>
</section>
<% } %>
<% if (post.tags && post.tags.length && (!page.meta || page.meta.tags != false)) { %>
<%
var items = [];
post.tags.each(function(item){
items.push('<div class="new-meta-item meta-tags"><a class="tag" href="'+url_for(item.path)+'"><i class="fas fa-hashtag" aria-hidden="true"></i>&nbsp;' + item.name + '</a></div>');
});
%>
<%- items.join(' ') %>
<% } %>
<% if (theme.share && (!page.meta || page.meta.share != false)) { %>
<%- partial('../_third-party/share') %>
<% } %>
</div>
</section>
<% } %>
<% if(post.prev || post.next){ %>
<div class="prev-next">
<% if(post.prev){ %>
<section class="prev">
<span class="art-item-left">
<h6><i class="fas fa-chevron-left" aria-hidden="true"></i>&nbsp;<%- __('post.prev_page') %></h6>
<h4>
<a href="<%=url_for(post.prev.path)%>" rel="prev" title="<%=post.prev.title%>">
<% if(post.prev.title){ %>
<%= post.prev.title %>
<% } else if (post.prev.date) { %>
<%= date(post.prev.date, config.date_format) %>
<% if(post.next){ %>
<section class="next">
<span class="art-item-right" aria-hidden="true">
<h6><%- __('post.next_page') %>&nbsp;<i class="fas fa-chevron-right" aria-hidden="true"></i></h6>
<h4>
<a href="<%=url_for(post.next.path)%>" rel="prev" title="<%=post.next.title%>">
<% if(post.next.title){ %>
<%= post.next.title %>
<% } else if (post.next.date) { %>
<%= date(post.next.date, config.date_format) %>
<% } %>
</a>
</h4>
<% if (post.prev.tags && post.prev.tags.length && post.prev.tags.each) { %>
<%
var items = [];
post.prev.tags.each(function(item){
items.push('<a class="tag" href="'+url_for(item.path)+'"><i class="fas fa-hashtag fa-fw" aria-hidden="true"></i>' + item.name + '</a>');
});
%>
<h6 class="tags">
<%- items.join(' ') %>
</h6>
<% } %>
</span>
</section>
<% } %>
<% if(post.next){ %>
<section class="next">
<span class="art-item-right" aria-hidden="true">
<h6><%- __('post.next_page') %>&nbsp;<i class="fas fa-chevron-right" aria-hidden="true"></i></h6>
<h4>
<a href="<%=url_for(post.next.path)%>" rel="prev" title="<%=post.next.title%>">
<% if(post.next.title){ %>
<%= post.next.title %>
<% } else if (post.next.date) { %>
<%= date(post.next.date, config.date_format) %>
<% } %>
</a>
</h4>
<% if (post.next.tags && post.next.tags.length && post.next.tags.each) { %>
<%
var items = [];
post.next.tags.each(function(item){
items.push('<a class="tag" href="'+url_for(item.path)+'"><i class="fas fa-hashtag fa-fw" aria-hidden="true"></i>' + item.name + '</a>');
});
%>
<h6 class="tags">
<%- items.join(' ') %>
</h6>
<% } %>
</span>
</section>
<%} %>
</div>
<%} %>
</section>
</a>
</h4>
<% if (post.next.tags && post.next.tags.length && post.next.tags.each) { %>
<%
var items = [];
post.next.tags.each(function(item){
items.push('<a class="tag" href="'+url_for(item.path)+'"><i class="fas fa-hashtag fa-fw" aria-hidden="true"></i>' + item.name + '</a>');
});
%>
<h6 class="tags">
<%- items.join(' ') %>
</h6>
<% } %>
</span>
</section>
<%} %>
</div>
<%} %>
</section>
</article>
<!-- 根据页面mathjax变量决定是否加载MathJax数学公式js -->

@ -3,94 +3,60 @@
} else {
var isPostList = false;
}
var hasMeta = false;
%>
<section class='meta'>
<% if(post.music && post.music.enable != false){ %>
<%- partial('../_third-party/aplayer',
{aplayer_theme: '', aplayer_mini: true, aplayer_mode: 'circulation',
aplayer_server: post.music.server, aplayer_type: post.music.type, aplayer_id: post.music.id,
aplayer_volume: post.music.volume?post.music.volume:'0.7', aplayer_autoplay: post.music.autoplay?true:false }) %>
<% } %>
<% if(post.thumbnail && post.thumbnail.length){ %>
<a title='<%- post.title %>' href='<%- url_for(post.path) %>'><img class='thumbnail' src='<%- post.thumbnail %>'></a>
<% } %>
<div class="meta" id="header-meta">
<% if(isPostList){ %>
<h2 class="title">
<a href="<%- url_for(post.path) %>">
<% if(post.title){ %>
<%- post.title %>
<% } else if (post.date) { %>
<%= date(post.date, config.date_format) %>
<% } %>
</a>
</h2>
<% } else { %>
<% if(page.title && (!page.meta || page.meta.title != false)){ %>
<h1 class="title"><%- page.title %></h1>
<% hasMeta = true %>
<% } %>
<% } %>
var topMetas = (theme.meta && theme.meta.header) || [];
if (post.meta && (post.meta.header !== undefined && post.meta.header !== null)) {
if (post.meta.header.length) {
topMetas = post.meta.header;
} else {
topMetas = [];
}
}
var bottomMetas = (theme.meta && theme.meta.footer) || [];
if (post.meta && (post.meta.footer !== undefined && post.meta.footer !== null)) {
if (post.meta.footer.length) {
bottomMetas = post.meta.footer;
} else {
bottomMetas = [];
}
}
%>
<div class='new-meta-box'>
<% if(config.author && (!post.meta || post.meta.author != false)){ %>
<div class='new-meta-item author'>
<a href="<%- url_for(config.url) %>">
<i class="fas fa-user" aria-hidden="true"></i>
<%- config.author %>
</a>
</div>
<% } %>
<% if(post.date && (!post.meta || post.meta.date != false)){ %>
<div class="new-meta-item date">
<a class='notlink'>
<i class="fas fa-calendar-alt" aria-hidden="true"></i>
<%= date(post.date, theme.date_format) %>
</a>
</div>
<% if (position == 'header') { %>
<section class='meta'>
<% if (post.music && post.music.enable != false) { %>
<%- partial('../_third-party/aplayer',
{aplayer_theme: '', aplayer_mini: true, aplayer_mode: 'circulation',
aplayer_server: post.music.server, aplayer_type: post.music.type, aplayer_id: post.music.id,
aplayer_volume: post.music.volume?post.music.volume:'0.7', aplayer_autoplay: post.music.autoplay?true:false }) %>
<% } %>
<% if(post.thumbnail && post.thumbnail.length){ %>
<a title='<%- post.title %>' href='<%- url_for(post.path) %>'><img class='thumbnail' src='<%- post.thumbnail %>'></a>
<% } %>
<div class="meta" id="header-meta">
<% if((topMetas).indexOf('title') > -1){ %>
<%- partial('../_meta/' + 'title', {post: post, isPostList: isPostList}) %>
<% } %>
<% if(post.categories && (!post.meta || post.meta.categories != false)){ %>
<% if (post.categories && post.categories.length && post.categories.forEach){ %>
<%
var cats = [];
var path;
post.categories.forEach(function(cat){
cats.push(cat.name);
path = cat.path;
});
%>
<div class='new-meta-item category'>
<a href='<%- url_for(path) %>'>
<i class="fas fa-folder-open" aria-hidden="true"></i>
<%- cats.join('&nbsp;/&nbsp;') %>
</a>
</div>
<% } %>
<div class='new-meta-box'>
<% (topMetas).forEach(function(meta){ %>
<% if(meta != 'title'){ %>
<%- partial('../_meta/' + meta, {post: post, isPostList: isPostList}) %>
<% } %>
<% }) %>
</div>
<% if ((topMetas).length > 0){ %>
<hr>
<% } %>
<% if(!isPostList && (!post.meta || post.meta.counter != false)){ %>
<% if (theme.busuanzi == true) { %>
<div class="new-meta-item browse busuanzi">
<a class='notlink'>
<i class="fas fa-eye" aria-hidden="true"></i>
<span id="busuanzi_value_page_pv">
<i class="fas fa-spinner fa-spin fa-fw" aria-hidden="true"></i>
</span>
</a>
</div>
</div>
</section>
<% } else if (position == 'footer') { %>
<section class='meta' id="footer-meta">
<hr>
<div class='new-meta-box'>
<% (bottomMetas).forEach(function(meta){ %>
<% if(meta != 'title'){ %>
<%- partial('../_meta/' + meta, {post: post, isPostList: isPostList}) %>
<% } %>
<% } %>
<% if(isPostList && post.top && (!post.meta || post.meta.top != false)){ %>
<div class="new-meta-item top-post">
<a class='notlink'>
<i class="fas fa-angle-double-up" aria-hidden="true"></i>
<%- post.top != true ? post.top : __('post.top') %>
</a>
</div>
<% } %>
<% }) %>
</div>
<% if( hasMeta ){ %>
<hr>
<% } %>
</div>
</section>
</section>
<% } %>

@ -1,5 +1,5 @@
<article class="post reveal <%= (post.title) ? "" : "no-title" %>">
<%- partial('meta',{post:post}) %>
<%- partial('meta',{post:post, position:'header'}) %>
<section class="article typo">
<div class="article-entry" itemprop="articleBody">
<%- post.excerpt || post.description || post.content %>

@ -3,7 +3,7 @@
<%
let supportWidgets = ['author', 'category', 'list', 'music', 'tagcloud', 'toc', 'plain', 'related_posts', 'grid'];
%>
<% if (page.sidebar){ %>
<% if (page.sidebar) { %>
<% page.sidebar.forEach(function(name){ %>
<% theme.sidebar.forEach(function(item){ %>
<% let widget_name = item.widget ? item.widget : 'plain'; %>

@ -1,34 +1,32 @@
<% if (theme.share && page.layout == 'post' && page.share != false) { %>
<div class="new-meta-item share -mob-share-list">
<i class="fas fa-share-alt" aria-hidden="true"></i>
<div class="-mob-share-list share-body">
<% (theme.share||[]).forEach(function(item){ %>
<% if (item.id == 'qrcode'){ %>
<a class='qrcode' rel="external nofollow noopener noreferrer" href='<%- qrcode(url) %>'>
<div class="new-meta-item share -mob-share-list">
<i class="fas fa-share-alt" aria-hidden="true"></i>
<div class="-mob-share-list share-body">
<% (theme.share||[]).forEach(function(item){ %>
<% if (item.id == 'qrcode'){ %>
<a class='qrcode' rel="external nofollow noopener noreferrer" href='<%- qrcode(url) %>'>
<% if (item.img){ %>
<img src="<%- item.img %>">
<% } else if (item.icon){ %>
<i class="<%- item.icon %> fa-fw"></i>
<% } %>
</a>
<% } else { %>
<a class="-mob-share-<%- item.id %>" title="<%- item.name %>" rel="external nofollow noopener noreferrer"
<% if (item.id == 'qzone'){ %>
href="https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=<%- post.permalink %>&title=<%- post.title + ' | ' + config.title %><%- (post.img || config.avatar) ? '&pics=' + (post.img || config.avatar) : '' %>&summary=<%- strip_html(post.excerpt) %>"
<% } else if (item.id == 'qq'){ %>
href="http://connect.qq.com/widget/shareqq/index.html?url=<%- post.permalink %>&title=<%- post.title + ' | ' + config.title %><%- (post.img || config.avatar) ? '&pics=' + (post.img || config.avatar) : '' %>&summary=<%- strip_html(post.excerpt) %>"
<% } else if (item.id == 'weibo'){ %>
href="http://service.weibo.com/share/share.php?url=<%- post.permalink %>&title=<%- post.title + ' | ' + config.title %><%- (post.img || config.avatar) ? '&pics=' + (post.img || config.avatar) : '' %>&summary=<%- strip_html(post.excerpt) %>"
<% } %>
>
<% if (item.img){ %>
<img src="<%- item.img %>">
<% } else if (item.icon){ %>
<i class="<%- item.icon %> fa-fw"></i>
<% } %>
</a>
<% } else { %>
<a class="-mob-share-<%- item.id %>" title="<%- item.name %>" rel="external nofollow noopener noreferrer"
<% if (item.id == 'qzone'){ %>
href="https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=<%- post.permalink %>&title=<%- post.title + ' | ' + config.title %><%- (post.img || config.avatar) ? '&pics=' + (post.img || config.avatar) : '' %>&summary=<%- strip_html(post.excerpt) %>"
<% } else if (item.id == 'qq'){ %>
href="http://connect.qq.com/widget/shareqq/index.html?url=<%- post.permalink %>&title=<%- post.title + ' | ' + config.title %><%- (post.img || config.avatar) ? '&pics=' + (post.img || config.avatar) : '' %>&summary=<%- strip_html(post.excerpt) %>"
<% } else if (item.id == 'weibo'){ %>
href="http://service.weibo.com/share/share.php?url=<%- post.permalink %>&title=<%- post.title + ' | ' + config.title %><%- (post.img || config.avatar) ? '&pics=' + (post.img || config.avatar) : '' %>&summary=<%- strip_html(post.excerpt) %>"
<% } %>
>
<% if (item.img){ %>
<img src="<%- item.img %>">
<% } else if (item.icon){ %>
<i class="<%- item.icon %> fa-fw"></i>
<% } %>
</a>
<% } %>
<% }) %>
</div>
</a>
<% } %>
<% }) %>
</div>
<% } %>
</div>

@ -1,7 +1,6 @@
<div class='l_main'>
<article id="<%= page.layout %>" class="post white-box article-type-<%= page.layout %>" itemscope itemprop="blogPost">
<%- partial('_partial/meta',{post:page}) %>
<%- partial('_partial/meta',{post:page, position:'header'}) %>
<section class="article typo l_friends">
<% if (page.links){ %>
<% (page.links||[]).forEach(function(group){ %>

Loading…
Cancel
Save