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. 30
      layout/_partial/article.ejs
  14. 104
      layout/_partial/meta.ejs
  15. 2
      layout/_partial/post.ejs
  16. 2
      layout/_third-party/share.ejs
  17. 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,37 +1,12 @@
<article id="<%= post.layout %>" class="post white-box article-type-<%= post.layout %>" itemscope itemprop="blogPost">
<%- partial('meta',{post:post}) %>
<%- partial('meta', {post: post, position: 'header'}) %>
<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>
<% } %>
<% 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') %>
<%- partial('meta', {post: post, position: 'footer'}) %>
<% } %>
</div>
</section>
<% } %>
<% if(post.prev || post.next){ %>
<div class="prev-next">
<% if(post.prev){ %>
@ -92,7 +67,6 @@
<%} %>
</section>
</article>
<!-- 根据页面mathjax变量决定是否加载MathJax数学公式js -->

@ -3,8 +3,25 @@
} else {
var isPostList = false;
}
var hasMeta = false;
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 = [];
}
}
%>
<% if (position == 'header') { %>
<section class='meta'>
<% if (post.music && post.music.enable != false) { %>
<%- partial('../_third-party/aplayer',
@ -16,81 +33,30 @@ var hasMeta = false;
<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 %>
<% } %>
<% if((topMetas).indexOf('title') > -1){ %>
<%- partial('../_meta/' + 'title', {post: post, isPostList: isPostList}) %>
<% } %>
<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(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>
<% } %>
<% } %>
<% 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>
<% } %>
<% (topMetas).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>
<% if ((topMetas).length > 0){ %>
<hr>
<% } %>
</div>
<% if( hasMeta ){ %>
</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}) %>
<% } %>
<% }) %>
</div>
</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 %>

@ -1,4 +1,3 @@
<% 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">
@ -31,4 +30,3 @@
<% }) %>
</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