Browse code

1. Made default layout more generic. 2. Added a page layout and improved html on post layout. 3. Improved flexibility of stylesheets for different layout types. 4. Collapsing sidebar now moves it to the bottom of the page and floats content into columns. 5. Improved sharing settings, added Google plus one.

Brandon Mathis authored on 12/07/2011 at 23:40:57
Showing 20 changed files
... ...
@@ -1,6 +1,7 @@
1 1
 @import "partials/header";
2 2
 @import "partials/navigation";
3 3
 @import "partials/blog";
4
+@import "partials/sharing";
4 5
 @import "partials/syntax";
5 6
 @import "partials/archive";
6 7
 @import "partials/sidebar";
... ...
@@ -19,7 +19,7 @@ body {
19 19
   max-width: $max-width;
20 20
   position: relative;
21 21
   margin: 0 auto;
22
-  > header, > nav, > footer, #articles > article, #articles > nav {
22
+  > header, > nav, > footer, #content > article, #content > div > article {
23 23
     @extend .group;
24 24
     padding-left: $pad-min;
25 25
     padding-right: $pad-min;
... ...
@@ -43,64 +43,77 @@ body {
43 43
   }
44 44
 }
45 45
 
46
-.toggle-sidebar { display: none; }
47
-#articles { width: 100%;
48
-  + aside {
46
+#content {
47
+  > div, > article { width: 100%; }
48
+  > aside {
49 49
     float: none;
50 50
     padding: 0 $pad-min 1px;
51
-    background-color: $sidebar-bg;
51
+    background-color: lighten($sidebar-bg, 2);
52 52
     border-top: 1px solid $sidebar-border;
53 53
   }
54 54
 }
55 55
 
56
+.toggle-sidebar { display: none; }
57
+
56 58
 @media only screen and (min-width: 550px) {
57 59
   body > header { font-size: 1em; }
60
+  #content aside {
61
+    @extend .group;
62
+    section {
63
+    &.odd, &.even { float: left; width: 48%; }
64
+    &.odd { margin-left: 0; }
65
+    &.even { margin-left: 4%; }
66
+   }
67
+  }
58 68
 }
59 69
 @media only screen and (min-width: 768px) {
60 70
   body { -webkit-text-size-adjust: auto; }
61 71
   body > header { font-size: 1.2em; }
62
-  body > nav {
63
-    + div {
64
-      @extend .group;
65
-      padding: 0;
66
-      margin: 0 auto;
67
-      > div {
68
-        @extend .group;
69
-        margin-right: $sidebar-width-medium;
70
-      }
71
-    }
72
+  #main {
73
+    @extend .group;
74
+    padding: 0;
75
+    margin: 0 auto;
72 76
   }
73
-  #articles {
74
-    padding-top: $pad-medium/2;
75
-    padding-bottom: $pad-medium/2;
76
-    float: left;
77
-    + aside {
77
+  #content {
78
+    @extend .group;
79
+    margin-right: $sidebar-width-medium;
80
+    position: relative;
81
+    > div, > article {
82
+      padding-top: $pad-medium/2;
83
+      padding-bottom: $pad-medium/2;
84
+      float: left;
85
+    }
86
+    > aside {
78 87
       width: $sidebar-width-medium - $sidebar-pad-medium*2;
79 88
       padding: 0 $sidebar-pad-medium $sidebar-pad-medium;
80 89
       background: none;
81 90
       float: left;
82 91
       margin: 0 -100% 0 0;
92
+      section, section.even { width: auto; margin: 0; }
83 93
     }
84
-  }
85
-  body > div > div { position: relative; }
86
-
87
-  .collapse-sidebar {
88
-    > div > div { margin-right: 10px; }
89
-    #articles + aside {
90
-      display: none;
91
-    }
92
-    .toggle-sidebar {
93
-      right: -1px;
94
-      background-color: $sidebar-bg;
95
-      border-right-width: 0;
96
-      text-indent: 2px;
97
-      border-left: 1px solid $sidebar-border;
98
-      @include border-bottom-right-radius(0);
99
-      @include border-bottom-left-radius(.3em);
100
-      @include link-colors(#aaa, #888);
94
+    .collapse-sidebar & {
95
+      margin-right: 10px;
96
+      > aside {
97
+        float: none;
98
+        clear: left;
99
+        width: auto;
100
+        margin: 0;
101
+        padding: 0 $pad-medium 1px;
102
+        background-color: lighten($sidebar-bg, 2);
103
+        border-top: 1px solid lighten($sidebar-border, 4);
104
+        section {
105
+          &.odd, &.even { float: left; width: 48%; }
106
+          &.odd { margin-left: 0; }
107
+          &.even { margin-left: 4%; }
108
+        }
109
+      }
110
+      > aside.thirds section {
111
+        width: 30%;
112
+        margin-left: 5%;
113
+        &.first { margin-left: 0; }
114
+      }
101 115
     }
102 116
   }
103
-
104 117
   .toggle-sidebar {
105 118
     outline: none;
106 119
     position: absolute; right: -21px; top: 0;
... ...
@@ -117,18 +130,37 @@ body {
117 117
     border-bottom: 1px solid $sidebar-border;
118 118
     border-right: 1px solid $sidebar-border;
119 119
     display: inline-block;
120
+    .collapse-sidebar & {
121
+      right: -11px;
122
+      width: 24px;
123
+      bottom: 0;
124
+      background-color: $sidebar-bg;
125
+      border-right-width: 0;
126
+      text-indent: 0px;
127
+      border-left: 1px solid $sidebar-border;
128
+      @include link-colors(#aaa, #888);
129
+      &:hover {
130
+       background: $sidebar-border;
131
+      }
132
+    }
120 133
   }
121 134
 }
122 135
 
123 136
 @media only screen and (min-width: 992px) {
124 137
   body > header { font-size: 1.3em; }
125
-  body > nav + div > div { margin-right: $sidebar-width-wide; }
126
-  #articles {
127
-    padding-top: $pad-wide/2;
128
-    padding-bottom: $pad-wide/2;
129
-    + aside {
138
+  #content { margin-right: $sidebar-width-wide; }
139
+  #content {
140
+    > div, > article {
141
+      padding-top: $pad-wide/2;
142
+      padding-bottom: $pad-wide/2;
143
+    }
144
+    > aside {
130 145
       width: $sidebar-width-wide - $sidebar-pad-wide*2;
131 146
       padding: 1.2em $sidebar-pad-wide $sidebar-pad-wide;
132 147
     }
148
+    .collapse-sidebar & aside {
149
+      padding: { left: $pad-wide; right: $pad-wide; }
150
+      @extend .group;
151
+    }
133 152
   }
134 153
 }
... ...
@@ -1,4 +1,4 @@
1
-#articles .blog-archives {
1
+#blog-archives {
2 2
   article {
3 3
     padding: 1em 0 1em;
4 4
     position: relative;
... ...
@@ -57,13 +57,11 @@
57 57
       padding:{left: 4.5em; bottom: .7em;}
58 58
     }
59 59
   a.category {
60
-    //text-align: right;
61 60
     line-height: 1.1em;
62
-    //float: right;
63 61
     }
64 62
   }
65 63
 }
66
-#articles .blog-archives.category {
64
+#content > .category {
67 65
   article {
68 66
     margin-left: 0;
69 67
     padding-left: 6.8em;
... ...
@@ -1,16 +1,17 @@
1
-#articles {
2
-  overflow: hidden;
3
-  ul, ol { margin-left: 1.4em; }
1
+#content {
2
+  article { ul, ol { margin-left: 1.4em; }}
4 3
   @media only screen and (min-width: 768px) {
5 4
     ul, ol { margin-left: 0; }
6 5
   }
7
-  > article {
6
+  > article, > div > article {
7
+    overflow: hidden;
8 8
     padding-bottom: 1em;
9 9
     &:last-child { margin-bottom: 0;  }
10 10
     h2 {
11 11
       padding-top: 0.8em;
12 12
       background: $img-border top left repeat-x;
13
-      &:first-child { background: none; padding-top: 0; }
13
+      .entry-content &:first-child { padding-top: 0; }
14
+      &:first-child { background: none; }
14 15
     }
15 16
     .byline + time:before, time +time:before, .comments:before, .byline ~ .categories:before {
16 17
       @extend .separator;
... ...
@@ -80,24 +81,20 @@
80 80
       }
81 81
     }
82 82
   }
83
-  iframe.twitter-share-button {
84
-    position: relative;
85
-    top: .3em;
86
-    padding-left: .5em;
87
-  }
88
-  > article > footer {
89
-    margin-top: 2em;
90
-    padding-top: 1em;
83
+  > div > article > footer {
91 84
     margin-bottom: 1.5em;
92 85
     background: $img-border top left repeat-x;
86
+    margin-top: 2em;
87
+    padding-top: 1em;
93 88
     @extend .sans;
89
+    p.meta { display: inline-block; font-size: .8em; }
94 90
   }
95 91
 
96 92
 }
97 93
 article + article {
98 94
   background: $img-border top left repeat-x;
99 95
 }
100
-#articles.blog-index {
96
+#content .blog-index {
101 97
   article header { background: none; padding-bottom: 0; }
102 98
   article h1 {
103 99
     font-size: 2.2em;
104 100
new file mode 100644
... ...
@@ -0,0 +1,7 @@
0
+footer .sharing {
1
+  display: inline-block;
2
+  position: relative;
3
+  top: .3em;
4
+  padding-left: .5em;
5
+  &:first-child { padding-left: 0; }
6
+}
... ...
@@ -1,7 +1,7 @@
1 1
 .highlight, html .gist .gist-file .gist-syntax .gist-highlight {
2 2
   .line-numbers {
3 3
     text-align: right;
4
-    font-size: .8em;
4
+    font-size: 13px;
5 5
     line-height: 1.45em;
6 6
     background: $base02 $noise-bg !important;
7 7
     border-right: 1px solid darken($base03, 2) !important;
... ...
@@ -57,7 +57,7 @@ pre {
57 57
   @extend .mono;
58 58
   border: 1px solid $pre-border;
59 59
   line-height: 1.45em;
60
-  font-size: .8em;
60
+  font-size: 13px;
61 61
   margin-bottom: 1.5em;
62 62
   padding: .8em 1em;
63 63
   color: $pre-color;
... ...
@@ -73,7 +73,7 @@ p code {
73 73
   display: inline-block;
74 74
   white-space: no-wrap;
75 75
   background: #fff;
76
-  font-size: .9em;
76
+  font-size: .8em;
77 77
   line-height: 1.5em;
78 78
   color: #555;
79 79
   border: 1px solid #ddd;
... ...
@@ -1,9 +1,9 @@
1 1
 .side-shadow-border {
2 2
   @include box-shadow(lighten($sidebar-bg, 5) 0 1px);
3 3
 }
4
-#articles + aside {
4
+#content > aside {
5 5
   color: $sidebar-color;
6
-  padding-top: 1.2em;
6
+  //padding-top: 1.2em;
7 7
   text-shadow: lighten($sidebar-bg, 8) 0 1px;
8 8
   section {
9 9
     @extend .sans;
... ...
@@ -1,4 +1,3 @@
1
-{% if page.single and site.recent_posts %}
2 1
 <section>
3 2
   <h1>Recent Posts</h1>
4 3
   <ul id="recent_posts">
... ...
@@ -9,4 +8,3 @@
9 9
     {% endfor %}
10 10
   </ul>
11 11
 </section>
12
-{% endif %}
13 12
new file mode 100644
... ...
@@ -0,0 +1,9 @@
0
+{% if site.google_plus_one %}
1
+  <script type="text/javascript">
2
+    (function() {
3
+      var script = document.createElement('script'); script.type = 'text/javascript'; script.async = true;
4
+      script.src = 'https://apis.google.com/js/plusone.js';
5
+      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(script, s);
6
+    })();
7
+  </script>
8
+{% endif %}
... ...
@@ -26,6 +26,8 @@
26 26
   <script src="/javascripts/octopress.js" type="text/javascript"></script>
27 27
   <link href='http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic' rel='stylesheet' type='text/css'>
28 28
   <link href='http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic' rel='stylesheet' type='text/css'>
29
-  {% include google_analytics.html %}
30 29
   <link href="/atom.xml" rel="alternate" title="{{site.title}}" type="application/atom+xml"/>
30
+  {% include google_analytics.html %}
31
+  {% include google_plus_one.html %}
32
+  {% include twitter_sharing.html %}
31 33
 </head>
... ...
@@ -1 +1,8 @@
1
-<a href="http://twitter.com/share" class="twitter-share-button" data-url="{{ site.url }}{{ page.url }}" data-via="{{ site.twitter_user }}" data-counturl="{{ site.url }}{{ page.url }}" >Tweet</a>
1
+<div class="sharing">
2
+  {% if site.twitter_tweet_button %}
3
+  <a href="http://twitter.com/share" class="twitter-share-button" data-url="{{ site.url }}{{ page.url }}" data-via="{{ site.twitter_user }}" data-counturl="{{ site.url }}{{ page.url }}" >Tweet</a>
4
+  {% endif %}
5
+  {% if site.google_plus_one %}
6
+  <g:plusone size="{{ site.google_plus_one_size }}"></g:plusone>
7
+  {% endif %}
8
+</div>
... ...
@@ -1,7 +1,3 @@
1
-<section>
2
-  <h1>About Me</h1>
3
-  <p>Hi, I'm Octopress!</p>
4
-</section>
5 1
 {% include asides/recent_posts.html %}
6 2
 {% include asides/twitter.html %}
7 3
 {% include asides/delicious.html %}
8 4
new file mode 100644
... ...
@@ -0,0 +1,11 @@
0
+{% if site.twitter_follow_button or site.twitter_tweet_button %}
1
+  <script type="text/javascript">
2
+    (function(){
3
+      var twitterWidgets = document.createElement('script');
4
+      twitterWidgets.type = 'text/javascript';
5
+      twitterWidgets.async = true;
6
+      twitterWidgets.src = 'http://platform.twitter.com/widgets.js';
7
+      document.getElementsByTagName('head')[0].appendChild(twitterWidgets);
8
+    })();
9
+  </script>
10
+{% endif %}
... ...
@@ -2,25 +2,14 @@
2 2
 <body {% if page.body_id %} id="{{ page.body_id }}" {% endif %} {% if page.sidebar == 'none' %} class="no-sidebar" {% endif %}>
3 3
   <header>{% include header.html %}</header>
4 4
   <nav>{% include navigation.html %}</nav>
5
-  <div>
6
-    <div>
7
-      <div id="articles" {% if page.blog_index %} class="blog-index" {% endif %}>{{ content }}</div>
5
+  <div id="main">
6
+    <div id="content">
7
+      {{ content }}
8 8
       {% unless page.sidebar == 'none' %}
9
-        <aside>{% include sidebar.html %}</aside>
9
+        <aside role=sidebar>{% include sidebar.html %}</aside>
10 10
       {% endunless %}
11 11
     </div>
12 12
   </div>
13 13
   <footer>{% include footer.html %}</footer>
14
-  {% if site.twitter_follow_button or site.twitter_tweet_button %}
15
-    <script type="text/javascript">
16
-      (function(){
17
-        var twitterWidgets = document.createElement('script');
18
-        twitterWidgets.type = 'text/javascript';
19
-        twitterWidgets.async = true;
20
-        twitterWidgets.src = 'http://platform.twitter.com/widgets.js';
21
-        document.getElementsByTagName('head')[0].appendChild(twitterWidgets);
22
-      })();
23
-    </script>
24
-  {% endif %}
25 14
 </body>
26 15
 </html>
... ...
@@ -1,5 +1,31 @@
1 1
 ---
2
-layout: post
2
+layout: default
3 3
 ---
4 4
 
5
-<!-- if you want a page layout -->
5
+<div>
6
+<article>
7
+  <header>
8
+    <h1 class="entry-title">{{ page.title | titlecase }}</h1>
9
+    {% unless page.no_meta or !index %}<p class="meta">{% include post_date.html %}</p>{% endunless %}
10
+  </header>
11
+  {{ content | smart_quotes }}
12
+  {% unless page.no_footer %}
13
+    <footer>
14
+      {% if page.date %}
15
+      <p class="meta">
16
+        {% include post_date.html %}
17
+      </p>
18
+      {% endif %}
19
+      {% unless page.no_sharing %}
20
+        {% include sharing.html %}
21
+      {% endunless %}
22
+    </footer>
23
+  {% endunless %}
24
+</article>
25
+{% if site.disqus_short_name and page.comments == true %}
26
+  <section>
27
+    <h1>Comments</h1>
28
+    <div id="disqus_thread">{% include disqus_thread.html %}</div>
29
+  </section>
30
+{% endif %}
31
+</div>
... ...
@@ -3,22 +3,24 @@ layout: default
3 3
 single: true
4 4
 ---
5 5
 
6
+<div>
6 7
 <article class="hentry">
7 8
   {% include article.html %}
8
-  {% unless page.no_meta %}
9 9
   <footer>
10 10
     <p class="meta">
11 11
       {% include post_author.html %}
12 12
       {% include post_date.html %}
13 13
       {% include post_categories.html %}
14
-      {% include sharing.html %}
15 14
     </p>
15
+    {% unless page.no_sharing %}
16
+    {% include sharing.html %}
17
+    {% endunless %}
16 18
   </footer>
17
-  {% endunless %}
18
-  {% if site.disqus_short_name %}
19
+</article>
20
+{% if site.disqus_short_name and page.no_comments != true %}
19 21
   <section>
20 22
     <h1>Comments</h1>
21 23
     <div id="disqus_thread">{% include disqus_thread.html %}</div>
22 24
   </section>
23
-  {% endif %}
24
-</article>
25
+{% endif %}
26
+</div>
... ...
@@ -1,9 +1,10 @@
1 1
 ---
2
-layout: post
2
+layout: page
3 3
 title: Blog Archive
4
-no_meta: true
4
+no_footer: true
5 5
 ---
6
-<div class="blog-archives">
6
+
7
+<div id="blog-archives">
7 8
 {% for post in site.posts reverse %}
8 9
 {% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %}
9 10
 {% unless year == this_year %}
... ...
@@ -2,6 +2,7 @@
2 2
 layout: default
3 3
 blog_index: true
4 4
 ---
5
+<div class="blog-index">
5 6
 {% assign index = true %}
6 7
 {% for post in paginator.posts %}
7 8
 {% assign content = post.content %}
... ...
@@ -13,7 +14,7 @@ blog_index: true
13 13
   {% if paginator.next_page %}
14 14
     <a href="/page{{paginator.next_page}}/">&larr; Older</a>
15 15
   {% endif %}
16
-  <a href="/blog/archives.html">Blog Archive</a>
16
+  <a href="/blog/archive.html">Blog Archive</a>
17 17
   {% if paginator.previous_page %}
18 18
     <a href="/page{{paginator.previous_page}}/">Newer &rarr;</a>
19 19
   {% endif %}
... ...
@@ -29,3 +30,4 @@ blog_index: true
29 29
     }());
30 30
 </script>
31 31
 {% endif %}
32
+</div>
... ...
@@ -9,7 +9,8 @@ function getNav(){
9 9
   });
10 10
 }
11 11
 function addSidebarToggler() {
12
-  $('#articles').before('<a href="#" class="toggle-sidebar">&raquo;</a>').previous().bind('click', function(e){
12
+  $('#content').prepend('<a href="#" class="toggle-sidebar">&raquo;</a>');
13
+  $('.toggle-sidebar').bind('click', function(e){
13 14
     e.preventDefault();
14 15
     if($('body').hasClass('collapse-sidebar')){
15 16
       $('body').removeClass('collapse-sidebar');
... ...
@@ -19,6 +20,15 @@ function addSidebarToggler() {
19 19
       e.target.innerHTML = '&laquo;';
20 20
     }
21 21
   });
22
+  sections = $('aside[role=sidebar] > section')
23
+  if(sections.length >= 3){ $('aside[role=sidebar]').addClass('thirds') }
24
+  sections.each(function(section, index){
25
+    if ((sections.length >= 3) && index % 3 == 0) {
26
+      $(section).addClass("first");
27
+    }
28
+    count = ((index +1) % 2) ? "odd" : "even";
29
+    $(section).addClass(count);
30
+  });
22 31
 }
23 32
 function testFeatures() {
24 33
   var features = ['maskImage'];
... ...
@@ -1,6 +1,7 @@
1 1
 # Required configuration
2 2
 source: source
3 3
 destination: public
4
+plugins: plugins
4 5
 code_dir: downloads/code
5 6
 port: 4000
6 7
 
... ...
@@ -34,6 +35,10 @@ twitter_follow_button: true
34 34
 twitter_show_follower_count: false
35 35
 twitter_tweet_button: true
36 36
 
37
+# Google Plus
38
+google_plus_one: true
39
+google_plus_one_size: medium
40
+
37 41
 # Pinboard
38 42
 pinboard_user:
39 43
 pinboard_count: 3