i18n
xaoxuu 6 years ago
parent 458d5924e4
commit 6c795f216c
  1. 23
      README.md
  2. 204
      layout/_partial/article.ejs
  3. 9
      layout/_partial/footer.ejs
  4. 2
      layout/_partial/post.ejs
  5. 2
      layout/_partial/post/recommended_posts.ejs
  6. 100
      layout/_partial/scripts.ejs
  7. 11
      source/less/_article.less

@ -166,8 +166,31 @@ menu:
@primary-color: @xiaowenwen-green;
// 强调色
@accent-color: @material-orange;
// ...
```
## 文章配置项
某一篇文章不想开启评论
```
---
comments: false
---
```
某一篇文章不想在底部显示推荐文章
```
---
recommended_posts: false
---
```
其他的暂时不想写了,自己摸索吧~

@ -1,134 +1,112 @@
<article id="<%= post.layout %>-<%= post.slug %>"
class="post white-box article-type-<%= post.layout %>"
itemscope itemprop="blogPost">
<section class='meta'>
<h2 class="title">
<a href="<%- url_for(post.path) %>">
<% if(post.title){ %>
<%= post.title %>
<% } else if (post.date) { %>
<%= date(post.date, 'YYYY-MM-DD dddd') %>
<% } %>
</a>
</h2>
<time>
<%= date(post.date, 'YYYY-MM-DD dddd') %>
,阅读量 <span id="busuanzi_value_page_pv"><i class="fa spinner fa-spin"></i></span> 次
</time>
<%- partial('categories',{post:post}) %>
</section>
<% if(post.toc!==false){ %>
<section class="toc-wrapper"><%- toc(post.content, {list_number: false}) %></section>
<% } %>
<section class="article typo">
<div class="article-entry" itemprop="articleBody">
<%- post.content %>
</div>
<% if (post.tags && post.tags.length) { %>
<div class="article-tags tags">
<% post.tags.each(function(item){ %>
<a href="<%- url_for(item.path) %>"><i class="fa fa-tag"></i> <%=item.name %></a>
<%})%>
</div>
<article id="<%= post.layout %>-<%= post.slug %>" class="post white-box article-type-<%= post.layout %>" itemscope itemprop="blogPost">
<section class='meta'>
<h2 class="title">
<a href="<%- url_for(post.path) %>">
<% if(post.title){ %>
<%= post.title %>
<% } else if (post.date) { %>
<%= date(post.date, 'YYYY-MM-DD dddd') %>
<% } %>
</a>
</h2>
<time>
<%= date(post.date, 'YYYY-MM-DD dddd') %>&nbsp;&nbsp;
<i class="fa fa-eye" aria-hidden="true"></i>&nbsp;<span id="busuanzi_value_page_pv"><i class="fa fa-spinner fa-spin fa-fw" aria-hidden="true"></i></span>
</time>
<%- partial('categories',{post:post}) %>
</section>
<% if(post.toc!==false){ %>
<section class="toc-wrapper"><%- toc(post.content, {list_number: false}) %></section>
<% } %>
<section class="article typo">
<div class="article-entry" itemprop="articleBody">
<%- post.content %>
</div>
<% if(post.prev || post.next){ %>
<div class="art-item-footer">
<% if(post.prev){ %>
<span class="art-item-left"><i class="icon icon-chevron-thin-left"></i>prev:<a href="<%=url_for(post.prev.path)%>" rel="prev" title="<%=post.prev.title%>">
<%= post.prev.title %>
</a></span>
<% } %>
<% if(post.next){ %>
<span class="art-item-right">next:<a href="<%=url_for(post.next.path) %>" rel="next" title="<%=post.next.title %>">
<%=post.next.title %>
</a><i class="icon icon-chevron-thin-right"></i></span>
<%} %>
</div>
<%} %>
<% if (post.tags && post.tags.length) { %>
<div class="article-tags tags">
<% post.tags.each(function(item){ %>
<a href="<%- url_for(item.path) %>"><i class="fa fa-tag"></i>&nbsp;&nbsp;<%=item.name %></a>
<%})%>
</div>
<% } %>
</section>
<% if(post.prev || post.next){ %>
<div class="art-item-footer">
<% if(post.prev){ %>
<span class="art-item-left">
<i class="fa fa-chevron-left" aria-hidden="true"></i>&nbsp;
<a href="<%=url_for(post.prev.path)%>" rel="prev" title="<%=post.prev.title%>">
<%= post.prev.title %>
</a>
</span>
<% } %>
<% if(post.next){ %>
<span class="art-item-right">
<a href="<%=url_for(post.next.path) %>" rel="next" title="<%=post.next.title %>">
<%=post.next.title %>
</a>&nbsp;
<i class="fa fa-chevron-right" aria-hidden="true"></i>
</span>
<%} %>
</div>
<%} %>
</section>
</article>
<br>
<article class="post white-box article-type-<%= post.layout %>>">
<section class="article typo">
<!-- 显示推荐文章和评论 -->
<% if (post && ((theme.recommended_posts.enabled && post.recommended_posts != false) || post.comments )) { %>
<article class="post white-box article-type-<%= post.layout %>>">
<section class="article typo">
<% if (post.comments) { %>
<% if (config.livere_shortname){ %>
<section id="comments">
<div id="lv-container" data-id="city" data-uid="MTAyMC8yOTU4Ny82MTU1">
<script type="text/javascript">
(function(d, s) {
var j, e = d.getElementsByTagName(s)[0];
if (typeof LivereTower === 'function') { return; }
j = d.createElement(s);
j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
j.async = true;
e.parentNode.insertBefore(j, e);
})(document, 'script');
</script>
<noscript>为正常使用来必力评论功能请激活JavaScript</noscript>
</div>
</section>
<% if (post && theme.recommended_posts.enabled && post.recommended_posts != false) { %>
<%- partial('post/recommended_posts', {page: post, site: site}) %>
<% } %>
<% if (config.disqus_shortname) { %>
<section id="comments">
<div id="disqus_thread">
无法加载评论系统,请确保您的网络能够正常访问 <a href="https://disqus.com">Disqus</a> 。
</div>
</section>
<% } %>
<% if (config.valine){ %>
<% if (config.valine.enable && config.valine.appId && config.valine.appKey){ %>
<% if (post.comments) { %>
<% if (config.livere_shortname || config.valine){ %>
<h4>评论</h4>
<% } %>
<% if (config.livere_shortname){ %>
<section id="comments">
<div id="lv-container" data-id="city" data-uid="MTAyMC8yOTU4Ny82MTU1">
<noscript>为正常使用来必力评论功能请激活JavaScript</noscript>
</div>
</section>
<% } %>
<% if (config.disqus_shortname) { %>
<section id="comments">
<div id="valine_container" class="valine_thread"></div>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="//unpkg.com/valine/dist/Valine.min.js"></script>
<script>
var GUEST_INFO = ['nick','mail','link'];
var guest_info = '<%= config.valine.guest_info %>'.split(',').filter(function(item){
return GUEST_INFO.indexOf(item) > -1
});
var notify = '<%= config.valine.notify %>' == true;
var verify = '<%= config.valine.verify %>' == true;
var valine = new Valine();
valine.init({
el: '#valine_container',
notify: notify,
verify: verify,
guest_info: guest_info,
appId: "<%= config.valine.appId %>",
appKey: "<%= config.valine.appKey %>",
placeholder: "<%= config.valine.placeholder %>",
pageSize:'<%= config.valine.pageSize %>',
avatar:'<%= config.valine.avatar %>',
lang:'<%= config.valine.lang %>'
})
</script>
<div id="disqus_thread">
无法加载评论系统,请确保您的网络能够正常访问 <a href="https://disqus.com">Disqus</a> 。
</div>
</section>
<% } %>
<% if (config.valine){ %>
<% if (config.valine.enable && config.valine.appId && config.valine.appKey){ %>
<section id="comments">
<div id="valine_container" class="valine_thread">
</i><i class="fa fa-spinner fa-spin fa-fw"></i>
</div>
</section>
<% } %>
<% } %>
<% } %>
<% } %>
<% if (post && theme.recommended_posts.enabled) { %>
<%- partial('post/recommended_posts', {page: post, site: site}) %>
<% } %>
</section>
</article>
</section>
</article>
<% } %>
<script>
window.subData = {
title: '<%= post.title %>',
tools: true
}
window.subData = {
title: '<%= post.title %>',
tools: true
}
</script>
<!-- recommended posts -->

@ -15,13 +15,8 @@
<div>博客内容遵循 <a target="_blank" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" class="licenses">知识共享 署名 - 非商业性 - 相同方式共享 4.0 国际协议</a></div>
<div>本站使用 <a href="https://blog.xaoxuu.com" target="_blank" class="codename">@xaoxuu</a> 发布的 <a href="https://github.com/xaoxuu/hexo-theme-material-x" target="_blank" class="codename">Material-X</a> 主题
<div id="busuanzi_container_site_pv">
<p>
总访客为 <span id="busuanzi_value_site_uv"><i class="fa spinner fa-spin"></i></span> 人次,
累计访问 <span id="busuanzi_value_site_pv"><i class="fa spinner fa-spin"></i></span> 次。
</p>
</div>
<div>本站使用 <a href="https://github.com/xaoxuu/hexo-theme-material-x" target="_blank" class="codename">Material-X</a> 作为主题,
总访问量为 <span id="busuanzi_value_site_pv"><i class="fa fa-spinner fa-spin fa-fw" aria-hidden="true"></i></span> 次。
</div>
</footer>

@ -26,7 +26,7 @@
<% if (post.tags && post.tags.length) { %>
<div class="full-width auto-padding tags">
<% post.tags.each(function(item){ %>
<a href="<%- url_for(item.path) %>"><i class="fa fa-tag"></i> <%=item.name %></a>
<a href="<%- url_for(item.path) %>"><i class="fa fa-tag"></i>&nbsp;&nbsp;<%=item.name %></a>
<%})%>
</div>
<% } %>

@ -1,7 +1,7 @@
<% var post_list = recommended_posts(page, site) %>
<% if(post_list.length > 0) { %>
<div class="recommended_posts">
<h3>推荐文章</h3>
<h4>你可能感兴趣的文章</h4>
<ul>
<% post_list.forEach(function(link) { %>
<li><a href="<%= link.permalink %>"><%= link.title %></a></li>

@ -1,38 +1,80 @@
<% if (config.disqus_shortname){ %>
<script>
var disqus_shortname = '<%= config.disqus_shortname %>';
<% if (page.permalink){ %>
var disqus_url = '<%= page.permalink %>';
<% } %>
(function(){
var dsq = document.createElement('script');
dsq.type = 'text/javascript';
dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/<% if (page.comments) { %>embed.js<% } else { %>count.js<% } %>';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<% } %>
<script src="//apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script src='//cdn.bootcss.com/node-waves/0.7.5/waves.min.js'></script>
<script src="//cdn.bootcss.com/scrollReveal.js/3.3.2/scrollreveal.min.js"></script>
<!-- 访问统计 -->
<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<!-- 推荐文章 -->
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="//unpkg.com/valine/dist/Valine.min.js"></script>
<%- js('js/jquery.fitvids.js') %>
<script>
var GOOGLE_CUSTOM_SEARCH_API_KEY = "<%- theme.search.google_api_key %>";
var GOOGLE_CUSTOM_SEARCH_ENGINE_ID = "<%- theme.search.google_engine_id %>";
var ALGOLIA_API_KEY = "<%- theme.search.algolia_api_key %>";
var ALGOLIA_APP_ID = "<%- theme.search.algolia_app_id %>";
var ALGOLIA_INDEX_NAME = "<%- theme.search.algolia_index_name %>";
var AZURE_SERVICE_NAME = "<%- theme.search.azure_service_name %>";
var AZURE_INDEX_NAME = "<%- theme.search.azure_index_name %>";
var AZURE_QUERY_KEY = "<%- theme.search.azure_query_key %>";
var BAIDU_API_ID = "<%- theme.search.baidu_api_id %>";
var SEARCH_SERVICE = "<%- theme.search.service %>";
var ROOT = "<%- config.root %>"||"/";
if(!ROOT.endsWith('/'))ROOT += '/';
var GOOGLE_CUSTOM_SEARCH_API_KEY = "<%- theme.search.google_api_key %>";
var GOOGLE_CUSTOM_SEARCH_ENGINE_ID = "<%- theme.search.google_engine_id %>";
var ALGOLIA_API_KEY = "<%- theme.search.algolia_api_key %>";
var ALGOLIA_APP_ID = "<%- theme.search.algolia_app_id %>";
var ALGOLIA_INDEX_NAME = "<%- theme.search.algolia_index_name %>";
var AZURE_SERVICE_NAME = "<%- theme.search.azure_service_name %>";
var AZURE_INDEX_NAME = "<%- theme.search.azure_index_name %>";
var AZURE_QUERY_KEY = "<%- theme.search.azure_query_key %>";
var BAIDU_API_ID = "<%- theme.search.baidu_api_id %>";
var SEARCH_SERVICE = "<%- theme.search.service %>";
var ROOT = "<%- config.root %>"||"/";
if(!ROOT.endsWith('/'))ROOT += '/';
</script>
<%- js('js/search.js') %>
<%- js('js/app.js') %>
<% if (page.comments) { %>
<% if (config.disqus_shortname){ %>
<script>
var disqus_shortname = '<%= config.disqus_shortname %>';
<% if (page.permalink){ %>
var disqus_url = '<%= page.permalink %>';
<% } %>
(function(){
var dsq = document.createElement('script');
dsq.type = 'text/javascript';
dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/<% if (page.comments) { %>embed.js<% } else { %>count.js<% } %>';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<% } %>
<% if (config.livere_shortname){ %>
<script type="text/javascript">
(function(d, s) {
var j, e = d.getElementsByTagName(s)[0];
if (typeof LivereTower === 'function') { return; }
j = d.createElement(s);
j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
j.async = true;
e.parentNode.insertBefore(j, e);
})(document, 'script');
</script>
<% } %>
<% if (config.valine){ %>
<% if (config.valine.enable && config.valine.appId && config.valine.appKey){ %>
<script>
var GUEST_INFO = ['nick','mail','link'];
var guest_info = '<%= config.valine.guest_info %>'.split(',').filter(function(item){
return GUEST_INFO.indexOf(item) > -1
});
var notify = '<%= config.valine.notify %>' == true;
var verify = '<%= config.valine.verify %>' == true;
var valine = new Valine();
valine.init({
el: '#valine_container',
notify: notify,
verify: verify,
guest_info: guest_info,
appId: "<%= config.valine.appId %>",
appKey: "<%= config.valine.appKey %>",
placeholder: "<%= config.valine.placeholder %>",
pageSize:'<%= config.valine.pageSize %>',
avatar:'<%= config.valine.avatar %>',
lang:'<%= config.valine.lang %>'
})
</script>
<% } %>
<% } %>
<% } %>

@ -95,6 +95,10 @@
font-weight: normal;
margin-top: 1.5em;
margin-bottom: 1em;
&:first-child{
margin-top: 0;
padding-top: 0;
}
&.title {
left: 0;
&:before {
@ -102,10 +106,13 @@
}
}
}
h1, h2 {
margin-top: 2em;
color: @text-color-theme;
margin-top: 2em;
&:first-child{
margin-top: 0;
padding-top: 0;
}
}
h1, h2, h3 {

Loading…
Cancel
Save