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

@ -1,6 +1,5 @@
<% var sections = page.body ? page.body : theme.body; %> <% var sections = page.body ? page.body : theme.layout.article.body; %>
<% sections.forEach(function(sectionName){ %> <% if (sections.indexOf('article') > -1) { %>
<% if (sectionName == 'article') { %>
<article id="<%= post.layout %>" class="post white-box article-type-<%= post.layout %>" itemscope itemprop="blogPost"> <article id="<%= post.layout %>" class="post white-box article-type-<%= post.layout %>" itemscope itemprop="blogPost">
<%- partial('meta', {post: post, position: 'header'}) %> <%- partial('meta', {post: post, position: 'header'}) %>
<section class="article typo"> <section class="article typo">
@ -71,9 +70,10 @@
<%} %> <%} %>
</section> </section>
</article> </article>
<% } else if (sectionName == 'comments') { %> <% } %>
<%- partial('../_third-party/' + sectionName) %> <% if (sections.indexOf('category') > -1 || sections.indexOf('tagcloud') > -1 || sections.indexOf('related_posts') > -1) { %>
<% } else { %> <% sections.forEach(function(sectionName){ %>
<% if (['category', 'tagcloud', 'related_posts'].indexOf(sectionName) > -1) { %>
<% theme.sidebar.forEach(function(item){ %> <% theme.sidebar.forEach(function(item){ %>
<% if (item.widget == sectionName) { %> <% if (item.widget == sectionName) { %>
<%- partial('../_widget/' + item.widget, {item: item}) %> <%- partial('../_widget/' + item.widget, {item: item}) %>
@ -81,6 +81,10 @@
<% }) %> <% }) %>
<% } %> <% } %>
<% }) %> <% }) %>
<% } %>
<% if (sections.indexOf('comments') > -1) { %>
<%- partial('../_third-party/comments') %>
<% } %>
<% <%
if (sections.indexOf('comments') < 0) { if (sections.indexOf('comments') < 0) {

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

@ -15,14 +15,29 @@
<% }) %> <% }) %>
<% }) %> <% }) %>
<% } else { %> <% } else { %>
<%
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){ %> <% theme.sidebar.forEach(function(item){ %>
<% if (item.enable != false){ %>
<% let widget_name = item.widget ? item.widget : 'plain'; %> <% let widget_name = item.widget ? item.widget : 'plain'; %>
<% if (item.enable != false && widget_name == name){ %>
<% if (supportWidgets.indexOf(widget_name) > -1){ %> <% if (supportWidgets.indexOf(widget_name) > -1){ %>
<%- partial('../_widget/' + item.widget, {item: item}) %> <%- partial('../_widget/' + item.widget, {item: item}) %>
<% } %> <% } %>
<% } %> <% } %>
<% }) %> <% }) %>
<% }) %>
<% } %> <% } %>
<% } %> <% } %>

@ -5,7 +5,7 @@
<header class='<%= theme.style %>'> <header class='<%= theme.style %>'>
<div><i class="<%- icon %> fa-fw" aria-hidden="true"></i>&nbsp;&nbsp;<%- title %></div> <div><i class="<%- icon %> fa-fw" aria-hidden="true"></i>&nbsp;&nbsp;<%- title %></div>
<% if (item.widget == 'toc') { %> <% 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) { %> <% } else if(item.more && item.more.url) { %>
<a class="rightBtn<%- item.more.animate ? ' ' + item.more.animate : '' %>" <a class="rightBtn<%- item.more.animate ? ' ' + item.more.animate : '' %>"
<% if (item.more.rel) { %> <% if (item.more.rel) { %>

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

Loading…
Cancel
Save