瀏覽代碼

Merge pull request #14 from atika/master

Some additionals options
ppoffice 10 年之前
父節點
當前提交
34252daf17

+ 3 - 0
_config.yml.example

@@ -18,6 +18,9 @@ widgets:
 - archive
 thumbnail: true
 
+# Additional Stylesheet
+customstylesheet: 'custom'
+
 # Contacts
 contacts:
   github: http://github.com/ppoffice

+ 3 - 0
layout/_partial/article.ejs

@@ -1,5 +1,8 @@
 <article id="<%= post.layout %>-<%= post.slug %>" class="article article-type-<%= post.layout %>" itemscope itemprop="blogPost">
   <div class="article-inner">
+    <% if (post.banner){ %>
+      <%- partial('post/banner') %>
+    <% } %>
     <%- partial('post/gallery') %>
     <% if (post.link || post.title){ %>
       <header class="article-header">

+ 3 - 0
layout/_partial/head.ejs

@@ -33,4 +33,7 @@
   <%- css('css/style') %>
   <%- css('font-awesome/css/font-awesome.min') %>
   <%- partial('google-analytics') %>
+  <% if( theme.customstylesheet ){ %>
+    <%- css('css/'+theme.customstylesheet) %>
+  <% } %>
 </head>

+ 10 - 0
layout/_partial/post/banner.ejs

@@ -0,0 +1,10 @@
+<% if (post.link){ %>
+	<a href="<%- url_for(post.link) %>" target="_blank" itemprop="url"><img src="<%- post.banner %>" class="article-banner"></a>
+<% } else if (post.title){ %>
+	<% if (index){ %>
+		<a href="<%- url_for(post.path) %>" itemprop="url"><img src="<%- post.banner %>" class="article-banner"></a>
+	<% } else { %>
+		<img src="<%- post.banner %>" class="article-banner">
+	<% } %>
+<% } %>
+

+ 13 - 6
layout/_partial/post/thumbnail.ejs

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

+ 1 - 1
layout/_widget/links.ejs

@@ -1,6 +1,6 @@
 <% if (site.posts.length){ %>
   <div class="widget-wrap widget-list">
-    <h3 class="widget-title"><%= __('sidebar.links') %></h3>
+    <h3 class="widget-title"><%= __('widget.links') %></h3>
     <div class="widget">
       <ul>
         <% for (var i in theme.links){ %>

+ 6 - 2
source/css/_partial/article.styl

@@ -5,15 +5,19 @@
   @extend $block
   overflow: hidden
 
+.article-banner
+  width:100%
+  height:auto
+
 .article-meta
   clearfix()
   & > div
     margin-bottom: 5px
   .article-date, .article-category
     margin-right: 10px
-    color: color-default
+    color: color-default + #444
   a
-    color: color-default
+    color: color-default + #444
     &:hover
       color: color-link
 

+ 6 - 0
source/css/_partial/highlight.styl

@@ -80,11 +80,17 @@ $line-numbers
       .gist-data
         background: none
         border: none
+        table
+          background: none
+        .pl-vo
+          color:#FFF
         .line-numbers
           @extend $line-numbers
           background: none
           border: none
           padding: 0 20px 0 0
+          height: font-size * line-height
+          vertical-align: top
         .line-data
           padding: 0 !important
       .highlight