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.
This commit is contained in:
Brandon Mathis
2011-07-12 19:40:57 -04:00
parent 67c5edb2f6
commit 5d1d04c52c
20 changed files with 196 additions and 103 deletions

View File

@ -1,4 +1,3 @@
{% if page.single and site.recent_posts %}
<section>
<h1>Recent Posts</h1>
<ul id="recent_posts">
@ -9,4 +8,3 @@
{% endfor %}
</ul>
</section>
{% endif %}

View File

@ -0,0 +1,9 @@
{% if site.google_plus_one %}
<script type="text/javascript">
(function() {
var script = document.createElement('script'); script.type = 'text/javascript'; script.async = true;
script.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(script, s);
})();
</script>
{% endif %}

View File

@ -26,6 +26,8 @@
<script src="/javascripts/octopress.js" type="text/javascript"></script>
<link href='http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic' rel='stylesheet' type='text/css'>
{% include google_analytics.html %}
<link href="/atom.xml" rel="alternate" title="{{site.title}}" type="application/atom+xml"/>
{% include google_analytics.html %}
{% include google_plus_one.html %}
{% include twitter_sharing.html %}
</head>

View File

@ -1 +1,8 @@
<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>
<div class="sharing">
{% if site.twitter_tweet_button %}
<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>
{% endif %}
{% if site.google_plus_one %}
<g:plusone size="{{ site.google_plus_one_size }}"></g:plusone>
{% endif %}
</div>

View File

@ -1,7 +1,3 @@
<section>
<h1>About Me</h1>
<p>Hi, I'm Octopress!</p>
</section>
{% include asides/recent_posts.html %}
{% include asides/twitter.html %}
{% include asides/delicious.html %}

View File

@ -0,0 +1,11 @@
{% if site.twitter_follow_button or site.twitter_tweet_button %}
<script type="text/javascript">
(function(){
var twitterWidgets = document.createElement('script');
twitterWidgets.type = 'text/javascript';
twitterWidgets.async = true;
twitterWidgets.src = 'http://platform.twitter.com/widgets.js';
document.getElementsByTagName('head')[0].appendChild(twitterWidgets);
})();
</script>
{% endif %}

View File

@ -2,25 +2,14 @@
<body {% if page.body_id %} id="{{ page.body_id }}" {% endif %} {% if page.sidebar == 'none' %} class="no-sidebar" {% endif %}>
<header>{% include header.html %}</header>
<nav>{% include navigation.html %}</nav>
<div>
<div>
<div id="articles" {% if page.blog_index %} class="blog-index" {% endif %}>{{ content }}</div>
<div id="main">
<div id="content">
{{ content }}
{% unless page.sidebar == 'none' %}
<aside>{% include sidebar.html %}</aside>
<aside role=sidebar>{% include sidebar.html %}</aside>
{% endunless %}
</div>
</div>
<footer>{% include footer.html %}</footer>
{% if site.twitter_follow_button or site.twitter_tweet_button %}
<script type="text/javascript">
(function(){
var twitterWidgets = document.createElement('script');
twitterWidgets.type = 'text/javascript';
twitterWidgets.async = true;
twitterWidgets.src = 'http://platform.twitter.com/widgets.js';
document.getElementsByTagName('head')[0].appendChild(twitterWidgets);
})();
</script>
{% endif %}
</body>
</html>

View File

@ -1,5 +1,31 @@
---
layout: post
layout: default
---
<!-- if you want a page layout -->
<div>
<article>
<header>
<h1 class="entry-title">{{ page.title | titlecase }}</h1>
{% unless page.no_meta or !index %}<p class="meta">{% include post_date.html %}</p>{% endunless %}
</header>
{{ content | smart_quotes }}
{% unless page.no_footer %}
<footer>
{% if page.date %}
<p class="meta">
{% include post_date.html %}
</p>
{% endif %}
{% unless page.no_sharing %}
{% include sharing.html %}
{% endunless %}
</footer>
{% endunless %}
</article>
{% if site.disqus_short_name and page.comments == true %}
<section>
<h1>Comments</h1>
<div id="disqus_thread">{% include disqus_thread.html %}</div>
</section>
{% endif %}
</div>

View File

@ -3,22 +3,24 @@ layout: default
single: true
---
<div>
<article class="hentry">
{% include article.html %}
{% unless page.no_meta %}
<footer>
<p class="meta">
{% include post_author.html %}
{% include post_date.html %}
{% include post_categories.html %}
{% include sharing.html %}
</p>
{% unless page.no_sharing %}
{% include sharing.html %}
{% endunless %}
</footer>
{% endunless %}
{% if site.disqus_short_name %}
</article>
{% if site.disqus_short_name and page.no_comments != true %}
<section>
<h1>Comments</h1>
<div id="disqus_thread">{% include disqus_thread.html %}</div>
</section>
{% endif %}
</article>
{% endif %}
</div>

View File

@ -1,9 +1,10 @@
---
layout: post
layout: page
title: Blog Archive
no_meta: true
no_footer: true
---
<div class="blog-archives">
<div id="blog-archives">
{% for post in site.posts reverse %}
{% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %}
{% unless year == this_year %}

View File

@ -2,6 +2,7 @@
layout: default
blog_index: true
---
<div class="blog-index">
{% assign index = true %}
{% for post in paginator.posts %}
{% assign content = post.content %}
@ -13,7 +14,7 @@ blog_index: true
{% if paginator.next_page %}
<a href="/page{{paginator.next_page}}/">&larr; Older</a>
{% endif %}
<a href="/blog/archives.html">Blog Archive</a>
<a href="/blog/archive.html">Blog Archive</a>
{% if paginator.previous_page %}
<a href="/page{{paginator.previous_page}}/">Newer &rarr;</a>
{% endif %}
@ -29,3 +30,4 @@ blog_index: true
}());
</script>
{% endif %}
</div>

View File

@ -9,7 +9,8 @@ function getNav(){
});
}
function addSidebarToggler() {
$('#articles').before('<a href="#" class="toggle-sidebar">&raquo;</a>').previous().bind('click', function(e){
$('#content').prepend('<a href="#" class="toggle-sidebar">&raquo;</a>');
$('.toggle-sidebar').bind('click', function(e){
e.preventDefault();
if($('body').hasClass('collapse-sidebar')){
$('body').removeClass('collapse-sidebar');
@ -19,6 +20,15 @@ function addSidebarToggler() {
e.target.innerHTML = '&laquo;';
}
});
sections = $('aside[role=sidebar] > section')
if(sections.length >= 3){ $('aside[role=sidebar]').addClass('thirds') }
sections.each(function(section, index){
if ((sections.length >= 3) && index % 3 == 0) {
$(section).addClass("first");
}
count = ((index +1) % 2) ? "odd" : "even";
$(section).addClass(count);
});
}
function testFeatures() {
var features = ['maskImage'];