i18n
xaoxuu 5 years ago
parent 1e0bc17523
commit c61179659f
  1. 35
      _config.yml
  2. 168
      layout/_partial/article.ejs
  3. 11
      layout/_partial/meta.ejs
  4. 25
      layout/_partial/side.ejs
  5. 2
      layout/_widget/header.ejs
  6. 9
      source/less/_header.less

@ -4,7 +4,7 @@ info:
docs: https://xaoxuu.com/wiki/material-x/
cdn: # 把对应的那一行注释掉就使用本地的文件
css:
style: https://cdn.jsdelivr.net/gh/xaoxuu/cdn-material-x@19.9.2/css/style.css
# style: https://cdn.jsdelivr.net/gh/xaoxuu/cdn-material-x@19.9.2/css/style.css
js:
app: https://cdn.jsdelivr.net/gh/xaoxuu/cdn-material-x@19.9/js/app.js
search: https://cdn.jsdelivr.net/gh/xaoxuu/cdn-material-x@19.9/js/search.js
@ -123,17 +123,28 @@ menu_mobile:
url: about/
rel: nofollow
# 默认的meta信息,文章中没有配置则按照这里的配置来显示,设置为false则不显示
# 其中,title只在header中有效,music和thumbnail无需在这里设置,文章中有则显示
# 如果tags放置在meta.header中,那么在post列表中不显示(因为卡片下方已经有了)
meta:
header: [title, author, date, categories, counter, top]
footer: [updated, tags, share]
# 主体元素,你也可以在页面的Front-matter中设置
body: [article, comments]
# 侧边栏小部件,默认按下面给定的顺序全部显示,文章中还可以自定义显示一部分以及顺序
layout:
# 文章列表(主页、自定义的列表布局)布局
posts:
# 每一篇文章的meta信息
meta: [title, author, date, categories, top]
# 侧边栏
sidebar: [author, grid, category, tagcloud, list]
# 文章页面布局
article:
# 主体元素,你也可以在页面的Front-matter中设置
body: [article, comments]
# 默认的meta信息,文章中没有配置则按照这里的配置来显示,设置为false则不显示
# 其中,title只在header中有效,music和thumbnail无需在这里设置,文章中有则显示
# 如果tags放置在meta.header中,那么在post列表中不显示(因为卡片下方已经有了)
header: [title, author, date, categories, counter, top]
footer: [updated, tags, share]
# 侧边栏(文章)
sidebar: [toc, related_posts]
# 其他的页面布局暂时等于文章列表
# 侧边栏小部件配置
sidebar:
- widget: author
avatar: https://cdn.jsdelivr.net/gh/xaoxuu/assets@master/avatar/avatar.png

@ -1,86 +1,90 @@
<% var sections = page.body ? page.body : theme.body; %>
<% sections.forEach(function(sectionName){ %>
<% if (sectionName == 'article') { %>
<article id="<%= post.layout %>" class="post white-box article-type-<%= post.layout %>" itemscope itemprop="blogPost">
<%- partial('meta', {post: post, position: 'header'}) %>
<section class="article typo">
<div class="article-entry" itemprop="articleBody">
<%- post.content %>
</div>
<% if(post.layout == 'post'){ %>
<br>
<%- 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-tag 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-tag fa-fw" aria-hidden="true"></i> ' + item.name + '</a>');
});
%>
<h6 class="tags">
<%- items.join(' ') %>
</h6>
<% } %>
</span>
</section>
<%} %>
</div>
<%} %>
</section>
</article>
<% } else if (sectionName == 'comments') { %>
<%- partial('../_third-party/' + sectionName) %>
<% } else { %>
<% theme.sidebar.forEach(function(item){ %>
<% if (item.widget == sectionName) { %>
<%- partial('../_widget/' + item.widget, {item: item}) %>
<% var sections = page.body ? page.body : theme.layout.article.body; %>
<% if (sections.indexOf('article') > -1) { %>
<article id="<%= post.layout %>" class="post white-box article-type-<%= post.layout %>" itemscope itemprop="blogPost">
<%- partial('meta', {post: post, position: 'header'}) %>
<section class="article typo">
<div class="article-entry" itemprop="articleBody">
<%- post.content %>
</div>
<% if(post.layout == 'post'){ %>
<br>
<%- 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-tag 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-tag fa-fw" aria-hidden="true"></i> ' + item.name + '</a>');
});
%>
<h6 class="tags">
<%- items.join(' ') %>
</h6>
<% } %>
</span>
</section>
<%} %>
</div>
<%} %>
</section>
</article>
<% } %>
<% if (sections.indexOf('category') > -1 || sections.indexOf('tagcloud') > -1 || sections.indexOf('related_posts') > -1) { %>
<% sections.forEach(function(sectionName){ %>
<% if (['category', 'tagcloud', 'related_posts'].indexOf(sectionName) > -1) { %>
<% theme.sidebar.forEach(function(item){ %>
<% if (item.widget == sectionName) { %>
<%- partial('../_widget/' + item.widget, {item: item}) %>
<% } %>
<% }) %>
<% } %>
<% }) %>
<% } %>
<% if (sections.indexOf('comments') > -1) { %>
<%- partial('../_third-party/comments') %>
<% } %>
<%
if (sections.indexOf('comments') < 0) {

@ -4,6 +4,11 @@
var isPostList = false;
}
var topMetas = (theme.meta && theme.meta.header) || [];
if (isPostList) {
topMetas = theme.layout.posts.meta || [];
} else {
topMetas = theme.layout.article.header || [];
}
if (post.meta && (post.meta.header !== undefined && post.meta.header !== null)) {
if (post.meta.header.length) {
topMetas = post.meta.header;
@ -12,6 +17,11 @@ if (post.meta && (post.meta.header !== undefined && post.meta.header !== null))
}
}
var bottomMetas = (theme.meta && theme.meta.footer) || [];
if (isPostList) {
bottomMetas = [];
} else {
bottomMetas = theme.layout.article.footer || [];
}
if (post.meta && (post.meta.footer !== undefined && post.meta.footer !== null)) {
if (post.meta.footer.length) {
bottomMetas = post.meta.footer;
@ -50,7 +60,6 @@ if (post.meta && (post.meta.footer !== undefined && post.meta.footer !== null))
</section>
<% } else if (position == 'footer') { %>
<section class='meta' id="footer-meta">
<div class='new-meta-box'>
<% (bottomMetas).forEach(function(meta){ %>
<% if(meta != 'title'){ %>

@ -15,13 +15,28 @@
<% }) %>
<% }) %>
<% } else { %>
<% theme.sidebar.forEach(function(item){ %>
<% if (item.enable != false){ %>
<%
var names = [];
if(is_home() || is_category() || is_archive() || is_tag() || page.layout == 'list') {
var isPostList = true;
} else {
var isPostList = false;
}
if (isPostList) {
names = theme.layout.posts.sidebar;
} else {
names = theme.layout.article.sidebar;
}
%>
<% names.forEach(function(name){ %>
<% theme.sidebar.forEach(function(item){ %>
<% let widget_name = item.widget ? item.widget : 'plain'; %>
<% if (supportWidgets.indexOf(widget_name) > -1){ %>
<%- partial('../_widget/' + item.widget, {item: item}) %>
<% if (item.enable != false && widget_name == name){ %>
<% if (supportWidgets.indexOf(widget_name) > -1){ %>
<%- partial('../_widget/' + item.widget, {item: item}) %>
<% } %>
<% } %>
<% } %>
<% }) %>
<% }) %>
<% } %>

@ -5,7 +5,7 @@
<header class='<%= theme.style %>'>
<div><i class="<%- icon %> fa-fw" aria-hidden="true"></i>&nbsp;&nbsp;<%- title %></div>
<% if (item.widget == 'toc') { %>
<div class='wrapper'><a class="s-toc rightBtn" rel="external nofollow noopener noreferrer" href="javascript:void(0)"><i class="fas fa-thumbtack fa-fw"></i></a></div>
<!-- <div class='wrapper'><a class="s-toc rightBtn" rel="external nofollow noopener noreferrer" href="javascript:void(0)"><i class="fas fa-thumbtack fa-fw"></i></a></div> -->
<% } else if(item.more && item.more.url) { %>
<a class="rightBtn<%- item.more.animate ? ' ' + item.more.animate : '' %>"
<% if (item.more.rel) { %>

@ -122,7 +122,14 @@
display: none;
font-size: @fontsize_base;
line-height: @height_navbar;
.s-toc {
display: none;
}
@media(max-width: @on_pad){
.s-toc {
display: block;
}
}
& > li{
height: @height_navbar - @gap;
.enable-trans();

Loading…
Cancel
Save