Removed include_array plugin, replaced it with include_sidebar plugin and reorganized sidebars

This commit is contained in:
Brandon Mathis 2012-06-16 17:17:33 -05:00
parent f1b57f39a1
commit 318e348163
17 changed files with 72 additions and 102 deletions

View File

@ -1,11 +0,0 @@
{% if site.googleplus_user %}
<section class="googleplus{% if site.googleplus_hidden %} googleplus-hidden{% endif %}">
<h1>
<a href="https://plus.google.com/{{ site.googleplus_user }}?rel=author">
<img src="http://www.google.com/images/icons/ui/gprofile_button-32.png" width="32" height="32">
Google+
</a>
</h1>
</section>
{% endif %}

View File

@ -1,4 +0,0 @@
<section>
<h1>About Me</h1>
<p>A little something about me.</p>
</section>

View File

@ -0,0 +1,4 @@
{% include sidebars/sections/twitter.html %}
{% include sidebars/sections/delicious.html %}
{% include sidebars/sections/pinboard.html %}
{% include sidebars/sections/google_plus.html %}

View File

@ -0,0 +1,5 @@
{% include sidebars/sections/recent_posts.html %}
{% include sidebars/sections/twitter.html %}
{% include sidebars/sections/delicious.html %}
{% include sidebars/sections/pinboard.html %}
{% include sidebars/sections/google_plus.html %}

View File

@ -0,0 +1,5 @@
{% include sidebars/sections/recent_posts.html %}
{% include sidebars/sections/twitter.html %}
{% include sidebars/sections/delicious.html %}
{% include sidebars/sections/pinboard.html %}
{% include sidebars/sections/google_plus.html %}

View File

@ -0,0 +1,6 @@
{% if site.google_plus_user %}
<a href="https://plus.google.com/{{ site.google_plus_user }}?rel=author">
<img src="https://ssl.gstatic.com/images/icons/gplus-{{ site.google_plus_image_size}}.png" alt="Google Plus icon">
</a>
{% endif %}

View File

@ -13,7 +13,7 @@ layout: default
{{ content }}
{% unless page.footer == false %}
<footer>
<p class="meta">{% include post/meta.html %}{% include custom/page_meta.html %}</p>
<p class="meta">{% include post/meta.html %}{% include custom/page-meta.html %}</p>
{% unless page.sharing == false %}
{% include post/sharing.html %}
{% endunless %}
@ -23,12 +23,12 @@ layout: default
{% include custom/after_page.html %}
{% if page.comments == true %}{% include comments.html %}{% endif %}
</div>
{% unless page.sidebar == false %}
{% unless page.sidebar == false or site.default_sidebar == false %}
<aside class="sidebar">
{% if site.page_asides.size %}
{% include_array page_asides %}
{% else %}
{% include_array default_asides %}
{% endif %}
  {% if page.sidebar == nil or page.sidebar == 'collapse' %}
   {% include_sidebar site.page_sidebar %}
  {% else %}
   {% include_sidebar %}
  {% endif %}
</aside>
{% endunless %}

View File

@ -28,12 +28,12 @@ single: true
{% include custom/after_post.html %}
{% if page.comments == true %}{% include comments.html %}{% endif %}
</div>
{% unless page.sidebar == false %}
{% unless page.sidebar == false or site.default_sidebar == false %}
<aside class="sidebar">
{% if site.post_asides.size %}
{% include_array post_asides %}
{% else %}
{% include_array default_asides %}
{% endif %}
  {% if page.sidebar == nil or page.sidebar == 'collapse' %}
   {% include_sidebar site.post_sidebar %}
  {% else %}
   {% include_sidebar %}
  {% endif %}
</aside>
{% endunless %}

View File

@ -19,10 +19,12 @@ layout: default
{% endif %}
</div>
</div>
{% unless page.sidebar == false or site.default_sidebar == false %}
<aside class="sidebar">
{% if site.blog_index_asides.size %}
{% include_array blog_index_asides %}
{% else %}
{% include_array default_asides %}
{% endif %}
  {% if page.sidebar == nil or page.sidebar == 'collapse' %}
   {% include_sidebar site.blog_index_sidebar %}
  {% else %}
   {% include_sidebar %}
  {% endif %}
</aside>
{% endunless %}

View File

@ -51,15 +51,11 @@ standard_post_marker:
titlecase: true # Converts page and post titles to titlecase
# list each of the sidebar modules you want to include, in the order you want them to appear.
# To add custom asides, create files in /source/_includes/custom/asides/ and add them to the list like 'custom/asides/custom_aside_name.html'
default_asides: [asides/recent_posts.html, asides/github.html, asides/twitter.html, asides/delicious.html, asides/pinboard.html, asides/googleplus.html]
# Each layout uses the default asides, but they can have their own asides instead. Simply uncomment the lines below
# and add an array with the asides you want to use.
# blog_index_asides:
# post_asides:
# page_asides:
# To change the layout's default sidebar Add a new sidebar source/_includes/sidebars/your_sidebar.html
# then make changes below, eg. post_sidebar: your_sidebar.html
blog_index_sidebar: blog_index_default.html
page_sidebar: page_default.html
post_sidebar: post_default.html
# ----------------------- #
# 3rd Party Settings #
@ -89,8 +85,9 @@ google_plus_one_size: medium
# Google Plus Profile
# Hidden: No visible button, just add author information to search results
googleplus_user:
googleplus_hidden: false
google_plus_user:
google_plus_hidden: false
google_plus_image_size: 32
# Pinboard
pinboard_user:

View File

@ -1,58 +0,0 @@
# Title: Include Array Tag for Jekyll
# Author: Jason Woodward http://www.woodwardjd.com
# Description: Import files on your filesystem as specified in a configuration variable in _config.yml. Mostly cribbed from Jekyll's include tag.
# Syntax: {% include_array variable_name_from_config.yml %}
#
# Example 1:
# {% include_array asides %}
#
# _config.yml snippet:
# asides: [asides/twitter.html, asides/custom/my_picture.html]
#
module Jekyll
class IncludeArrayTag < Liquid::Tag
Syntax = /(#{Liquid::QuotedFragment}+)/
def initialize(tag_name, markup, tokens)
if markup =~ Syntax
@array_name = $1
else
raise SyntaxError.new("Error in tag 'include_array' - Valid syntax: include_array [array from _config.yml]")
end
super
end
def render(context)
includes_dir = File.join(context.registers[:site].source, '_includes')
if File.symlink?(includes_dir)
return "Includes directory '#{includes_dir}' cannot be a symlink"
end
rtn = ''
(context.environments.first['site'][@array_name] || []).each do |file|
if file !~ /^[a-zA-Z0-9_\/\.-]+$/ || file =~ /\.\// || file =~ /\/\./
rtn = rtn + "Include file '#{file}' contains invalid characters or sequences"
end
Dir.chdir(includes_dir) do
choices = Dir['**/*'].reject { |x| File.symlink?(x) }
if choices.include?(file)
source = File.read(file)
partial = Liquid::Template.parse(source)
context.stack do
rtn = rtn + partial.render(context)
end
else
rtn = rtn + "Included file '#{file}' not found in _includes directory"
end
end
end
rtn
end
end
end
Liquid::Template.register_tag('include_array', Jekyll::IncludeArrayTag)

View File

@ -0,0 +1,24 @@
module Jekyll
class IncludeSidebarTag < Liquid::Tag
def initialize(tag_name, file, tokens)
super
@file = file.strip
end
def render(context)
file = (@file == "" ? context['page.sidebar'] : @file)
if file.include? 'site.'
file = context[file]
end
render_include "sidebars/#{file}", context
end
def render_include(file, context)
tag = IncludeTag.new('', file, [])
tag.render(context)
end
end
end
Liquid::Template.register_tag('include_sidebar', Jekyll::IncludeSidebarTag)