Skip to content

Commit

Permalink
优化Generate速度,refs #13
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangming committed Sep 19, 2014
1 parent 93d4a45 commit b0f1873
Show file tree
Hide file tree
Showing 16 changed files with 25 additions and 23 deletions.
6 changes: 3 additions & 3 deletions layout/_partial/after-footer.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var duoshuoQuery = {short_name:"<%= theme.duoshuo_shortname %>"};
var dsq = document.createElement('script');
dsq.type = 'text/javascript';
dsq.async = true;
dsq.src = '//go.disqus.com/<% if (page.comments){ %>embed.js<% } else { %>count.js<% } %>';
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>
Expand All @@ -46,8 +46,8 @@ var duoshuoQuery = {short_name:"<%= theme.duoshuo_shortname %>"};
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<% if (theme.fancybox){ %>
<link rel="stylesheet" href="<%- config.root %>fancybox/jquery.fancybox.css" media="screen" type="text/css">
<script src="<%- config.root %>fancybox/jquery.fancybox.pack.js"></script>
<%- css('fancybox/jquery.fancybox') %>
<%- js('fancybox/jquery.fancybox.pack') %>
<% } %>

<%- js('js/script') %>
2 changes: 1 addition & 1 deletion layout/_partial/archive.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<% last = year; %>
<section class="archives-wrap">
<div class="archive-year-wrap">
<a href="<%- config.root %>archives/<%= year %>" class="archive-year"><%= year %></a>
<a href="<%- url_for('archives/' + year) %>" class="archive-year"><%= year %></a>
</div>
<div class="archives">
<% } %>
Expand Down
2 changes: 1 addition & 1 deletion layout/_partial/article.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<%- post.excerpt %>
<% if (theme.excerpt_link){ %>
<p class="article-more-link">
<a href="<%- config.root %><%- post.path %>#more"><%= __('excerpt_link') %></a>
<a href="<%- url_for(post.path) %>#more"><%= theme.excerpt_link %></a>
</p>
<% } %>
<% } else { %>
Expand Down
4 changes: 2 additions & 2 deletions layout/_partial/footer.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<div class="outer">
<div id="footer-info" class="inner">
&copy; <%= date(new Date(), 'YYYY') %> <%= config.author || config.title %><br>
Powered by <a href="http://zespia.tw/hexo/" target="_blank">Hexo</a>
Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
.
Theme by <a href="https://github.com/xiangming/landscape-plus" target="_blank">Landscape+</a>
Theme by <a href="https://github.com/xiangming/landscape-plus" target="_blank">Landscape-plus</a>
</div>
</div>
</footer>
6 changes: 3 additions & 3 deletions layout/_partial/header.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
<div id="header-outer" class="outer">
<div id="header-title" class="inner">
<h1 id="logo-wrap">
<a href="<%- config.root %>" id="logo"><%= config.title %></a>
<a href="<%- url_for() %>" id="logo"><%= config.title %></a>
</h1>
<% if (theme.subtitle){ %>
<h2 id="subtitle-wrap">
<a href="<%- config.root %>" id="subtitle"><%= theme.subtitle %></a>
<a href="<%- url_for() %>" id="subtitle"><%= theme.subtitle %></a>
</h2>
<% } %>
</div>
<div id="header-inner" class="inner">
<nav id="main-nav">
<a id="main-nav-toggle" class="nav-icon"></a>
<% for (var i in theme.menu){ %>
<a class="main-nav-link" href="<%- theme.menu[i] %>"><%= i %></a>
<a class="main-nav-link" href="<%- url_for(theme.menu[i]) %>"><%= i %></a>
<% } %>
</nav>
<nav id="sub-nav">
Expand Down
2 changes: 1 addition & 1 deletion layout/_partial/mobile-nav.ejs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<nav id="mobile-nav">
<% for (var i in theme.menu){ %>
<a href="<%- theme.menu[i] %>" class="mobile-nav-link"><%= i %></a>
<a href="<%- url_for(theme.menu[i]) %>" class="mobile-nav-link"><%= i %></a>
<% } %>
</nav>
2 changes: 1 addition & 1 deletion layout/_partial/post/date.ejs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<a href="<%- config.root %><%- post.path %>" class="<%= class_name %>">
<a href="<%- url_for(post.path) %>" class="<%= class_name %>">
<time datetime="<%= date_xml(post.date) %>" itemprop="datePublished"><%= date(post.date, date_format) %></time>
</a>
4 changes: 2 additions & 2 deletions layout/_partial/post/gallery.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<div class="article-gallery">
<div class="article-gallery-photos">
<% post.photos.forEach(function(photo, i){ %>
<a class="article-gallery-img fancybox" href="<%- photo %>" rel="gallery_<%= post._id %>">
<img src="<%- photo %>" itemprop="image">
<a class="article-gallery-img fancybox" href="<%- url_for(photo) %>" rel="gallery_<%= post._id %>">
<img src="<%- url_for(photo) %>" itemprop="image">
</a>
<% }) %>
</div>
Expand Down
4 changes: 2 additions & 2 deletions layout/_partial/post/nav.ejs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<% if (post.prev || post.next){ %>
<nav id="article-nav">
<% if (post.prev){ %>
<a href="<%- config.root %><%- post.prev.path %>" id="article-nav-newer" class="article-nav-link-wrap">
<a href="<%- url_for(post.prev.path) %>" id="article-nav-newer" class="article-nav-link-wrap">
<strong class="article-nav-caption">Newer</strong>
<div class="article-nav-title">
<% if (post.prev.title){ %>
Expand All @@ -13,7 +13,7 @@
</a>
<% } %>
<% if (post.next){ %>
<a href="<%- config.root %><%- post.next.path %>" id="article-nav-older" class="article-nav-link-wrap">
<a href="<%- url_for(post.next.path) %>" id="article-nav-older" class="article-nav-link-wrap">
<strong class="article-nav-caption">Older</strong>
<div class="article-nav-title"><%= post.next.title %></div>
</a>
Expand Down
4 changes: 2 additions & 2 deletions layout/_partial/post/title.ejs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<% if (post.link){ %>
<h1 itemprop="name">
<a class="<%= class_name %>" href="<%- post.link %>" target="_blank" itemprop="url"><%= post.title %></a>
<a class="<%= class_name %>" href="<%- url_for(post.link) %>" target="_blank" itemprop="url"><%= post.title %></a>
</h1>
<% } else if (post.title){ %>
<% if (index){ %>
<h1 itemprop="name">
<a class="<%= class_name %>" href="<%- config.root %><%- post.path %>"><%= post.title %></a>
<a class="<%= class_name %>" href="<%- url_for(post.path) %>"><%= post.title %></a>
</h1>
<% } else { %>
<h1 class="<%= class_name %>" itemprop="name">
Expand Down
2 changes: 1 addition & 1 deletion layout/_widget/recent_posts.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ul>
<% site.posts.sort('date', -1).limit(5).each(function(post){ %>
<li>
<a href="<%- config.root %><%- post.path %>"><%= post.title || '(no title)' %></a>
<a href="<%- url_for(post.path) %>"><%= post.title || '(no title)' %></a>
</li>
<% }) %>
</ul>
Expand Down
8 changes: 4 additions & 4 deletions layout/layout.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
<body>
<div id="container">
<div id="wrap">
<%- partial('_partial/header') %>
<%- partial('_partial/header', null, {cache: !config.relative_link}) %>
<div class="outer">
<section id="main"><%- body %></section>
<% if (theme.sidebar && theme.sidebar !== 'bottom'){ %>
<%- partial('_partial/sidebar') %>
<%- partial('_partial/sidebar', null, {cache: !config.relative_link}) %>
<% } %>
</div>
<%- partial('_partial/footer') %>
<%- partial('_partial/footer', null, {cache: !config.relative_link}) %>
</div>
<%- partial('_partial/mobile-nav') %>
<%- partial('_partial/mobile-nav', null, {cache: !config.relative_link}) %>
<%- partial('_partial/after-footer') %>
</div>
</body>
Expand Down
2 changes: 2 additions & 0 deletions source/css/_partial/archive.styl
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
overflow: hidden
a, span
padding: 10px 20px
line-height: 1
height: 2ex
a
color: color-grey
text-decoration: none
Expand Down
Binary file removed source/css/images/board-bg.png
Binary file not shown.
Binary file removed source/css/images/content-bg.png
Binary file not shown.
Binary file removed source/css/images/sidebar-bg.png
Binary file not shown.

0 comments on commit b0f1873

Please sign in to comment.