i18n
xaoxuu 4 years ago
parent e1ae9d2c50
commit dc1715d364
  1. 15
      layout/_cover/search.ejs
  2. 2
      layout/_meta/category.ejs
  3. 2
      layout/_meta/counter.ejs
  4. 2
      layout/_meta/tags.ejs
  5. 2
      layout/_meta/thumbnail.ejs
  6. 4
      layout/_meta/title.ejs
  7. 63
      layout/_partial/archive.ejs
  8. 10
      layout/_partial/article.ejs
  9. 2
      layout/_partial/categories.ejs
  10. 2
      layout/_partial/footer.ejs
  11. 2
      layout/_partial/head.ejs
  12. 19
      layout/_partial/header.ejs
  13. 2
      layout/_partial/meta.ejs
  14. 6
      layout/_partial/post.ejs
  15. 2
      layout/_widget/blogger.ejs
  16. 4
      layout/_widget/category.ejs
  17. 13
      layout/_widget/grid.ejs
  18. 13
      layout/_widget/list.ejs
  19. 4
      layout/_widget/qrcode.ejs
  20. 2
      layout/archive.ejs
  21. 2
      layout/category.ejs
  22. 2
      layout/links.ejs

@ -1,5 +1,14 @@
<%
function getURL(url) {
if (url.indexOf('://') < 0) {
return url_for_lang(url);
} else {
return url;
}
}
%>
<% if (theme.cover.logo) { %>
<img class='logo' src='<%- url_for(theme.cover.logo) %>'/>
<img class='logo' src='<%- theme.cover.logo %>'/>
<% } else { %>
<p class="title <%- theme.backstretch && theme.backstretch.is_dark ? 'white' : '' %>"><%- theme.cover.title ? theme.cover.title : config.title %></p>
<% if (theme.cover.subtitle) { %>
@ -20,14 +29,14 @@
<% (theme.cover.features || []).forEach(function(value){ %>
<li>
<a class="nav home <%- theme.backstretch && theme.backstretch.is_dark ? 'white' : '' %>"
href="<%= url_for(value.url) %>"
href="<%= getURL(value.url) %>"
<% if (value.rel) { %>
rel="<%- value.rel %>"
<% } %>
<% if (value.target) { %>
target="<%- value.target %>"
<% } %>
id="<%= url_for(value.url).replace(/\/|%/g, "")?url_for(value.url).replace(/\/|%/g, ""):"home" %>">
id="<%= getURL(value.url).replace(/\/|%/g, "")?getURL(value.url).replace(/\/|%/g, ""):"home" %>">
<i class='<%= value.icon %> fa-fw'></i>&nbsp;<%= __('navbar.'+value.name) == ('navbar.'+value.name) ? value.name : __('navbar.'+value.name) %>
</a>
</li>

@ -8,7 +8,7 @@
});
%>
<div class='new-meta-item category'>
<a href='<%- url_for(path) %>' rel="nofollow">
<a href='<%- url_for_lang(path) %>' rel="nofollow">
<i class="<%- theme.meta.category.icon %>" aria-hidden="true"></i>
<p><%- cats.join('&nbsp;/&nbsp;') %></p>
</a>

@ -3,7 +3,7 @@
<div class="new-meta-item browse valine">
<a class='notlink'>
<i class="<%- theme.meta.counter.icon %>" aria-hidden="true"></i>
<span id="<%- url_for(page.path) %>" class="leancloud_visitors" data-flag-title="<%- page.title %>">
<span id="<%- url_for_lang(page.path) %>" class="leancloud_visitors" data-flag-title="<%- page.title %>">
<p>
<span class="leancloud-visitors-count">
<i class="fas fa-spinner fa-spin fa-fw" aria-hidden="true"></i>

@ -2,7 +2,7 @@
<%
var items = [];
post.tags.each(function(item){
items.push('<div class="new-meta-item meta-tags"><a class="tag" href="'+url_for(item.path)+'" rel="nofollow"><i class="' + theme.meta.tags.icon + '" aria-hidden="true"></i><p>' + item.name + '</p></a></div>');
items.push('<div class="new-meta-item meta-tags"><a class="tag" href="'+url_for_lang(item.path)+'" rel="nofollow"><i class="' + theme.meta.tags.icon + '" aria-hidden="true"></i><p>' + item.name + '</p></a></div>');
});
%>
<%- items.join(' ') %>

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

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

@ -1,42 +1,49 @@
<% if (site.posts && site.posts.length > 0) { %>
<section class="post-list <%- theme.layout.multiple_columns ? 'multiple-columns' : '' %>">
<% if (!page.prev) { %>
<% if (is_home()) { %>
<% site.posts.each(function(post){ %>
<% if (post.top) { %>
<% if (page.group == undefined || post.group == page.group) { %>
<div class='post-wrapper'>
<%- partial('post', {post: post}) %>
</div>
<% } %>
<% } %>
<% }) %>
<% } else if (page.posts && page.posts.length > 0) { %>
<% page.posts.each(function(post){ %>
<% if (post.top) { %>
<% if (is_home()) {
if (!page.prev) {
// 置顶的文章
site.posts.forEach(function(post){
if (post.top) { %>
<div class='post-wrapper'>
<%- partial('post', {post: post}) %>
</div>
<% } %>
<% }) %>
<% } %>
<% } %>
<% if (page.posts && page.posts.length > 0) { %>
<% page.posts.each(function(post){ %>
<% if (!post.top) { %>
</div> <%
}
})
}
if (page.posts && page.posts.length > 0) {
page.posts.forEach(function(post){
if (!post.top) { %>
<div class='post-wrapper'>
<%- partial('post', {post: post}) %>
</div> <%
}
})
}
} else {
// 其它页面想要展示首页内容(hexo只支持首页分页)
site.posts.forEach(function(post){
if (post.top) { %>
<div class='post-wrapper'>
<%- partial('post', {post: post}) %>
</div>
<% } %>
<% }) %>
<% } %>
</div> <%
}
})
site.posts.sort(config.index_generator.order_by).forEach(function(post){
if (!post.top) { %>
<div class='post-wrapper'>
<%- partial('post', {post: post}) %>
</div> <%
}
})
} %>
</section>
<% if (page && page.posts) { %>
<% if (page.total > 1) { %>
<br>
<div class="prev-next">
<% if (page.prev != 0) { %>
<a class="prev" rel="prev" href="<%= url_for(page.prev_link) %>">
<a class="prev" rel="prev" href="<%= url_for_lang(page.prev_link) %>">
<section class="post prev white-box <%- theme.style.shadow.card ? 'card-shadow' : '' %> <%- theme.style.blur && theme.style.blur.widget ? 'widget-blur' : '' %>" >
<i class="fas fa-chevron-left" aria-hidden="true"></i>&nbsp;<%- __('post.prev_page') %>&nbsp;
</section>
@ -46,7 +53,7 @@
<%= page.current%> / <%= page.total%>
</p>
<% if (page.next != 0) { %>
<a class="next" rel="next" href="<%= url_for(page.next_link) %>">
<a class="next" rel="next" href="<%= url_for_lang(page.next_link) %>">
<section class="post next white-box <%- theme.style.shadow.card ? 'card-shadow' : '' %> <%- theme.style.blur && theme.style.blur.widget ? 'widget-blur' : '' %>">
&nbsp;<%- __('post.next_page') %>&nbsp;<i class="fas fa-chevron-right" aria-hidden="true"></i>
</section>

@ -6,7 +6,7 @@
<section class="article typo">
<div class="article-entry" itemprop="articleBody">
<% (post.photos||[]).forEach(function(photo){ %>
<fancybox><img src='<%- url_for(photo) %>'/></fancybox>
<fancybox><img src='<%- url_for_lang(photo) %>'/></fancybox>
<% }) %>
<%- post.content %>
<% if(theme.layout.on_page.footer && (page.layout == 'post')){ %>
@ -31,7 +31,7 @@
<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%>">
<a href="<%=url_for_lang(post.prev.path)%>" rel="prev" title="<%=post.prev.title%>">
<% if(post.prev.title){ %>
<%= post.prev.title %>
<% } else if (post.prev.date) { %>
@ -43,7 +43,7 @@
<%
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>');
items.push('<a class="tag" href="'+url_for_lang(item.path)+'"><i class="fas fa-tag fa-fw" aria-hidden="true"></i> ' + item.name + '</a>');
});
%>
<h6 class="tags">
@ -58,7 +58,7 @@
<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%>">
<a href="<%=url_for_lang(post.next.path)%>" rel="prev" title="<%=post.next.title%>">
<% if(post.next.title){ %>
<%= post.next.title %>
<% } else if (post.next.date) { %>
@ -70,7 +70,7 @@
<%
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>');
items.push('<a class="tag" href="'+url_for_lang(item.path)+'"><i class="fas fa-tag fa-fw" aria-hidden="true"></i> ' + item.name + '</a>');
});
%>
<h6 class="tags">

@ -2,7 +2,7 @@
<%
var cats = [];
post.categories.forEach(function(cat){
cats.push('<a class="categories" href="'+url_for(cat.path)+'">' + cat.name + '</a>');
cats.push('<a class="categories" href="'+url_for_lang(cat.path)+'">' + cat.name + '</a>');
});
%>
<div class='metatag cats'>

@ -4,7 +4,7 @@
<div class="social-wrapper">
<% (theme.social||[]).forEach(function(value){ %>
<% if (value.url && value.icon) { %>
<a href="<%= url_for(value.url) %>"
<a href="<% value.url %>"
class="social <%- value.icon %> flat-btn"
target="_blank"
rel="external nofollow noopener noreferrer">

@ -59,7 +59,7 @@
<% } %>
<% if (config.favicon) { %>
<link rel="shortcut icon" type='image/x-icon' href="<%- url_for(config.favicon) %>">
<link rel="shortcut icon" type='image/x-icon' href="<%- config.favicon %>">
<% } %>
<% if (theme.aplayer.enable) { %>

@ -1,3 +1,12 @@
<%
function getURL(url) {
if (url.indexOf('://') < 0) {
return url_for_lang(url);
} else {
return url;
}
}
%>
<header class="l_header<%- page.sidebar == false ? ' no_sidebar' : '' %> <%- theme.style.blur && theme.style.blur.navbar ? 'nav-blur' : '' %>">
<div id="loading-bar-wrapper">
<div id="loading-bar"></div>
@ -5,7 +14,7 @@
<div class='wrapper'>
<div class="nav-main container container--flex">
<% if (theme.navbar.logo) { %>
<a class="logo flat-box" target="_self" href='<%- url_for("/") %>' >
<a class="logo flat-box" target="_self" href='<%- getURL("/") %>' >
<% if (theme.navbar.logo.img) { %>
<img class='logo' src='<%- theme.navbar.logo.img %>'/>
<% } else { %>
@ -28,14 +37,14 @@
<% if (theme.navbar.menu.on_desktop) { %>
<% (theme.navbar.menu.on_desktop || []).forEach(function(value){ %>
<li>
<a class="nav flat-box" href="<%= url_for(value.url) %>"
<a class="nav flat-box" href="<%= getURL(value.url) %>"
<% if (value.rel) { %>
rel="<%- value.rel %>"
<% } %>
<% if (value.target) { %>
target="<%- value.target %>"
<% } %>
id="<%= url_for(value.url).replace(/\/|%/g, "")?url_for(value.url).replace(/\/|%/g, ""):"home" %>">
id="<%= getURL(value.url).replace(/\/|%/g, "")?getURL(value.url).replace(/\/|%/g, ""):"home" %>">
<i class='<%= value.icon %> fa-fw'></i>&nbsp;<%= __('navbar.'+value.name) == ('navbar.'+value.name) ? value.name : __('navbar.'+value.name) %>
</a>
</li>
@ -77,14 +86,14 @@
<% if (theme.navbar.menu.on_mobile) { %>
<% (theme.navbar.menu.on_mobile || []).forEach(function(value){ %>
<li>
<a class="nav flat-box" href="<%= url_for(value.url) %>"
<a class="nav flat-box" href="<%= getURL(value.url) %>"
<% if (value.rel) { %>
rel="<%- value.rel %>"
<% } %>
<% if (value.target) { %>
target="<%- value.target %>"
<% } %>
id="<%= url_for(value.url).replace(/\/|%/g, "")?url_for(value.url).replace(/\/|%/g, ""):"home" %>">
id="<%= getURL(value.url).replace(/\/|%/g, "")?getURL(value.url).replace(/\/|%/g, ""):"home" %>">
<i class='<%= value.icon %> fa-fw'></i>&nbsp;<%= __('navbar.'+value.name) == ('navbar.'+value.name) ? value.name : __('navbar.'+value.name) %>
</a>
</li>

@ -37,7 +37,7 @@ if (post.meta && (post.meta.footer !== undefined && post.meta.footer !== null))
<%- partial('../_third-party/aplayer', {post: post, where: 'meta'}) %>
<% } %>
<% if(post.thumbnail && post.thumbnail.length){ %>
<a title='<%- post.title %>' href='<%- url_for(post.link || post.path) %>'><img class='thumbnail' src='<%- post.thumbnail %>'></a>
<a title='<%- post.title %>' href='<%- url_for_lang(post.link || post.path) %>'><img class='thumbnail' src='<%- post.thumbnail %>'></a>
<% } %>
<div class="meta" id="header-meta">
<% if((topMetas).indexOf('title') > -1){ %>

@ -6,20 +6,20 @@
<% if ((post.readmore != false) && (post.excerpt || post.description || post.link)) { %>
<% if (theme.readmore) { %>
<div class="button readmore">
<a href="<%- url_for(post.link || post.path) %>" class="flat-box">
<a href="<%- url_for_lang(post.link || post.path) %>" class="flat-box">
<i class="fas fa-book-open fa-fw" aria-hidden="true"></i>
<%- __('post.read_more') %>
</a>
</div>
<% } else { %>
<% } %>
<% } %>
</div>
<!-- <% if (post.tags && post.tags.length) { %>
<div class="full-width auto-padding tags">
<% post.tags.each(function(item){ %>
<a href="<%- url_for(item.path) %>" rel="nofollow"><i class="fas fa-tag fa-fw"></i> <%=item.name %></a>
<a href="<%- url_for_lang(item.path) %>" rel="nofollow"><i class="fas fa-tag fa-fw"></i> <%=item.name %></a>
<%})%>
</div>
<% } %> -->

@ -24,7 +24,7 @@
<div class="social-wrapper">
<% (theme.social||[]).forEach(function(value){ %>
<% if (value.url && value.icon) { %>
<a href="<%- url_for(value.url) %>"
<a href="<%- value.url %>"
class="social <%- value.icon %> flat-btn"
target="_blank"
rel="external nofollow noopener noreferrer">

@ -6,8 +6,8 @@
<ul class="entry navigation">
<% site.categories.sort('path').each(function(category){ %>
<li><a class="flat-box<%= category.parent ? ' child' : ''%>"
title="<%- url_for(category.path) %>" href="<%- url_for(category.path) %>"
id="<%= url_for(category.path).replace(/\/|%/g, "")?url_for(category.path).replace(/\/|%/g, ""):"home" %>"
title="<%- url_for_lang(category.path) %>" href="<%- url_for_lang(category.path) %>"
id="<%= url_for_lang(category.path).replace(/\/|%/g, "")?url_for_lang(category.path).replace(/\/|%/g, ""):"home" %>"
><div class='name'><%- category.name %></div><div class='badge'>(<%- category.posts.length %>)</div></a></li>
<% }) %>
</ul>

@ -1,17 +1,26 @@
<%- partial('_pre') %>
<%
function getURL(url) {
if (url.indexOf('://') < 0) {
return url_for_lang(url);
} else {
return url;
}
}
%>
<section class="widget <%- item.class %> <%- page.widget_style %> <%- page.widget_platform %>">
<%- partial('header', {item: item}) %>
<div class='content'>
<ul class="grid navigation">
<% (item.rows||[]).forEach(function(row){ %>
<li><a class="flat-box" title="<%- url_for(row.url) %>" href="<%- url_for(row.url) %>"
<li><a class="flat-box" title="<%- getURL(row.url) %>" href="<%- getURL(row.url) %>"
<% if (row.rel) { %>
rel="<%- row.rel %>"
<% } %>
<% if (row.target) { %>
target="<%- row.target %>"
<% } %>
id="<%= url_for(row.url).replace(/\/|%/g, "")?url_for(row.url).replace(/\/|%/g, ""):"home" %>">
id="<%= getURL(row.url).replace(/\/|%/g, "")?getURL(row.url).replace(/\/|%/g, ""):"home" %>">
<% if (row.img) { %>
<img src="<%- row.img %>">
<% } else if(row.avatar) { %>

@ -1,17 +1,26 @@
<%- partial('_pre') %>
<%
function getURL(url) {
if (url.indexOf('://') < 0) {
return url_for_lang(url);
} else {
return url;
}
}
%>
<section class="widget <%- item.class %> <%- page.widget_style %> <%- page.widget_platform %>">
<%- partial('header', {item: item}) %>
<div class='content'>
<ul class="list entry navigation">
<% (item.rows||[]).forEach(function(row){ %>
<li><a class="flat-box" title="<%- url_for(row.url) %>" href="<%- url_for(row.url) %>"
<li><a class="flat-box" title="<%- getURL(row.url) %>" href="<%- getURL(row.url) %>"
<% if (row.rel) { %>
rel="<%- row.rel %>"
<% } %>
<% if (row.target) { %>
target="<%- row.target %>"
<% } %>
id="<%= url_for(row.url).replace(/\/|%/g, "")?url_for(row.url).replace(/\/|%/g, ""):"home" %>"
id="<%= getURL(row.url).replace(/\/|%/g, "")?getURL(row.url).replace(/\/|%/g, ""):"home" %>"
>
<div class='name'>
<% if(row.img) { %>

@ -4,12 +4,12 @@
<div class='content article-entry'>
<% (item.images||[]).forEach(function(url){ %>
<% if (item.fancybox == true) { %>
<fancybox><img src='<%- url_for(url) %>'
<fancybox><img src='<%- url %>'
<% if (item.height) { %>
height='<%- item.height %>'
<% } %>></fancybox>
<% } else { %>
<img src='<%- url_for(url) %>'
<img src='<%- url %>'
<% if (item.height) { %>
height='<%- item.height %>'
<% } %>>

@ -17,7 +17,7 @@
</div>
<% } %>
<div class="archive-item archive-post mark">
<a href="<%= url_for(post.link || post.path) %>">
<a href="<%= url_for_lang(post.link || post.path) %>">
<time><%= date(post.date, 'MM-DD') %></time>
<span class="title">
<% if(post.title){ %>

@ -13,7 +13,7 @@
<div class="archive-item archive-post mark all-categories">
<% if (site.categories.length){ %>
<% site.categories.sort('path').each(function(category){ %>
<a class="<%= category.parent ? ' child' : ''%>" href="<%= url_for(category.path) %>">
<a class="<%= category.parent ? ' child' : ''%>" href="<%= url_for_lang(category.path) %>">
<time><i class='fas fa-folder-open fa-fw' aria-hidden="true"></i>&nbsp;&nbsp;<%= category.name %></time>
<span class="title">
(<%- category.posts.length %>)

@ -20,7 +20,7 @@
<div class='friend-content'>
<% (group.items||[]).forEach(function(item){ %>
<a class='friend-card' style='background:<%- item.backgroundColor %>; color:<%- item.textColor %>'
target="_blank" rel="external nofollow noopener noreferrer" href='<%- url_for(item.url || '') %>'>
target="_blank" rel="external nofollow noopener noreferrer" href='<%- item.url || '' %>'>
<div class='friend-left'>
<% if(item.avatar){ %>
<img class='avatar' src='<%- item.avatar %>'/>

Loading…
Cancel
Save