Sfoglia il codice sorgente

Merge pull request #1 from ppoffice/master

Update to latest
Benjamin Sproule 10 anni fa
parent
commit
af8ee00874

+ 21 - 9
README.md

@@ -32,11 +32,11 @@ git pull
 ```r
 # Header
 menu:
-  Home: /
-  Archives: /archives
-  Categories: /categories # -> you need to add extra page to enable this, please see the config below.
-  Tags: /tags # -> you need to add extra page to enable this, please see the config below.
-  About: /about
+  Home: .
+  Archives: archives
+  Categories: categories # you need to add extra page to enable this, please see the config below.
+  Tags: tags             # you need to add extra page to enable this, please see the config below.
+  About: about
 
 # Content
 excerpt_link: Read More
@@ -58,7 +58,7 @@ contacts:
   twitter: '#'
   facebook: '#'
   dribbble: '#'
-  rss: /atom.xml
+  rss: atom.xml
 
 # Links
 links:
@@ -66,7 +66,7 @@ links:
 
 # Miscellaneous
 google_analytics:
-favicon: /favicon.png
+favicon: favicon.png
 twitter:
 google_plus:
 fb_admins:
@@ -107,7 +107,19 @@ disqus_shortname:
 - **location** - Where you live in.
 - **disqus_shortname** - Your Disqus shortname.
 
-## Custom Categories & Tags Pages
+### Post Thumbnail & Banner
+
+You can add a thumbnail and a banner to each post by adding the following lines into your post source files' front-matter:
+```r
+title: Demo
+date: 2015-01-01
+...
+# add those
+thumbnail: http://example.com/thumbnail.jpg
+banner: http://example.com/banner.jpg
+```
+
+### Custom Categories & Tags Pages
 
 To enable custom categories page and tags page, just copy the `categories` folder and `tags` folder under your theme's `_source` foler into your site's `source` folder. Then edit theme's _config.yml and add the following lines: 
 ```r
@@ -119,7 +131,7 @@ menu:
   ...
 ```
 
-## Languages
+### Languages
 
 English and Simplified Chinese are the default languages of the theme. You can add translations in the `languages` folder and change the default language in blog's `_config.yml`.
 

+ 8 - 8
_config.yml.example

@@ -1,10 +1,10 @@
 # Header
 menu:
-  Home: /
-  Archives: /archives
-  Categories: /categories
-  Tags: /tags
-  About: /about
+  Home: .
+  Archives: archives
+  Categories: categories
+  Tags: tags
+  About: about
 
 # Content
 excerpt_link: Read More
@@ -29,7 +29,7 @@ contacts:
   twitter: '#'
   facebook: '#'
   dribbble: '#'
-  rss: /atom.xml
+  rss: atom.xml
 
 # Links
 links:
@@ -37,8 +37,8 @@ links:
 
 # Miscellaneous
 google_analytics:
-favicon: /favicon.png
+favicon: favicon.png
 twitter:
 google_plus:
 fb_admins:
-fb_app_id:
+fb_app_id:

+ 1 - 0
_config.yml.site.example

@@ -13,6 +13,7 @@ location: 'Harbin, China'
 follow: https://github.com/ppoffice/
 language: en
 timezone:
+since: 2000 # The start year showing in your copyright section.
 
 # URL
 ## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'

+ 1 - 1
layout/_partial/article.ejs

@@ -52,4 +52,4 @@
       <noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript">comments powered by DuoShuo.</a></noscript>
       </div>
   </section>
-<% } %>
+<% } %>

+ 1 - 1
layout/_partial/footer.ejs

@@ -4,7 +4,7 @@
   <% } %>
   <div class="outer">
     <div id="footer-info" class="inner">
-      &copy; <%= date(new Date(), 'YYYY') %> <%= config.author || config.title %><br>
+      &copy; <% if (config.since && config.since != date(new Date(), 'YYYY')){ %><%= config.since %> - <% } %><%= date(new Date(), 'YYYY') %> <%= config.author || config.title %><br>
       Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>. Theme by <a href="http://github.com/ppoffice">PPOffice</a>
     </div>
   </div>

+ 2 - 2
layout/_partial/header.ejs

@@ -1,7 +1,7 @@
 <header id="header">
   <div id="header-main" class="header-inner">
     <div class="outer">
-      <a href="<%- url_for() %>" id="logo"><i class="logo"></i><span class="site-title"><%= config.title %></span></a>
+      <a href="<%- url_for('.') %>" id="logo"><i class="logo"></i><span class="site-title"><%= config.title %></span></a>
       <nav id="main-nav">
         <% for (var i in theme.menu){ %>
           <a class="main-nav-link" href="<%- url_for(theme.menu[i]) %>"><%= i %></a>
@@ -31,4 +31,4 @@
       </tr>
     </table>
   </div>
-</header>
+</header>

+ 8 - 6
layout/_partial/post/date.ejs

@@ -1,6 +1,8 @@
-<div class="<%= class_name %>">
-  <i class="fa fa-calendar"></i>
-  <a href="<%- url_for(post.path) %>">
-    <time datetime="<%= date_xml(post.date) %>" itemprop="datePublished"><%= date(post.date, date_format) %></time>
-  </a>
-</div>
+<% if (post.date && !post.hidedate){ %>
+  <div class="<%= class_name %>">
+    <i class="fa fa-calendar"></i>
+    <a href="<%- url_for(post.path) %>">
+      <time datetime="<%= date_xml(post.date) %>" itemprop="datePublished"><%= date(post.date, date_format) %></time>
+    </a>
+  </div>
+<% } %>

+ 4 - 2
layout/_partial/post/thumbnail.ejs

@@ -1,14 +1,16 @@
 <a href="<%- url_for((post.link?post.link:post.path)) %>" class="thumbnail">
   <%
     var s = "";
-    
+
     if (post.thumbnail){
       s = post.thumbnail;
     }else if (post.banner){
       s = post.banner;
+    }else if (post.photos && post.photos.length){
+      s = post.photos[0];
     }else{
       var img=/\<img\s.*?\s?src\s*=\s*['|"]?([^\s'"]+).*?\>/ig;
-      var result = post.content.match(img);  
+      var result = post.content.match(img);
       result = img.exec(post.content);
       if(result != null) {
         for(var i = result.length -1; i; --i){