new, jekyll-based blog

This commit is contained in:
James Walker 2012-01-02 23:15:05 -05:00
commit 33dd1812f8
16 changed files with 464 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
_site
_drafts

14
_config.yml Normal file
View File

@ -0,0 +1,14 @@
title: walkah
slogan: striving towards mediocrity
author: James Walker
url: http://walkah.net
auto: false
pygments: true
lsi: false
markdown: rdiscount
permalink: blog/:title
paginate: 10
pagination_dir: blog
exclude: Gemfile, Gemfile.lock

12
_includes/post.html Normal file
View File

@ -0,0 +1,12 @@
<article class="hentry" role="article">
<header>
<h1 class="entry-title">{{ post.title }}</h1>
</header>
<div class="entry-content">
{{ content }}
</div>
<footer class="meta">
<p>posted in: {{ post.tags | tag_links }}</p>
<time datetime="{{ post.date | datetime | date_to_xmlschema }}" pubdate>&mdash; <a href="/{{ post.url }}">{{ post.date | date: "%B %d, %Y" }}</a></time>
</footer>
</article>

5
_includes/vcard.html Normal file
View File

@ -0,0 +1,5 @@
<div class="vcard">
<img src="http://www.gravatar.com/avatar/b29b5419f81fa03145cafc684bb20c76.png?s=75" class="photo left" alt="James Walker" >
<p><a href="/about/" class="fn n">James Walker</a> (a.k.a. <a href="http://walkah.net/" rel="me" class="url nickname uid">walkah</a>) is a free software developer and advocate for the open web. He is a long time <a href="http://drupal.org/user/1531" rel="me">Drupal</a> developer.</p>
<p>You can follow him on <a href="https://twitter.com/walkah" rel="me">twitter</a> or <a href="https://github.com/walkah">github</a>.</p>
</div>

36
_layouts/default.html Normal file
View File

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>{% if page.title %}{{ page.title }} | {% endif %}{{ site.title }}</title>
<meta name="description" content="{{ site.description }}">
<meta name="author" content="{{ site.author }}">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
<link href='http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic' rel='stylesheet' type='text/css'>
<link rel="shortcut icon" href="/favicon.ico" >
<link href="/atom.xml" rel="alternate" title="{{site.title}}" type="application/atom+xml">
</head>
<body>
<header>
<h1><a href="/">{{ site.title }}</a></h1>
<h2>{{ site.slogan }}</h1>
</header>
<nav role="navigation">
<ul class="navigation">
<li><a href="/">Home</a></li>
<li><a href="/blog/">Blog</a></li>
<li><a href="/about/">About</a></li>
</ul>
</nav>
<section id="main">
{{ content }}
</section>
<footer>
&copy; 2002-{{ site.time | date:"%Y" }} {{ site.author }}
</footer>
</body>
</html>

9
_layouts/page.html Normal file
View File

@ -0,0 +1,9 @@
---
layout: default
---
<article>
<header>
<h1>{{ page.title }}</h1>
</header>
{{ content }}
</article>

7
_layouts/post.html Normal file
View File

@ -0,0 +1,7 @@
---
layout: default
---
{% assign post=page %}
{% include post.html %}
{% include vcard.html %}

26
_layouts/tag_feed.xml Normal file
View File

@ -0,0 +1,26 @@
---
layout: nil
---
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[{{ site.title }}]]></title>
<link href="{{ site.url }}/atom.xml" rel="self"/>
<link href="{{ site.url }}/"/>
<updated>{{ site.time | date_to_xmlschema }}</updated>
<id>{{ site.url }}/</id>
<author>
<name><![CDATA[{{ site.author | strip_html }}]]></name>
{% if site.email %}<email><![CDATA[{{ site.email }}]]></email>{% endif %}
</author>
{% for post in site.tags[page.tag] limit: 20 %}
<entry>
<title type="html"><![CDATA[{{ post.title | cdata_escape }}]]></title>
<link href="{{ site.url }}/{{ post.url }}"/>
<updated>{{ post.date | date_to_xmlschema }}</updated>
<id>{{ site.url }}/{{ post.id }}</id>
<content type="html"><![CDATA[{{ post.content | expand_urls: site.url | markdownify| cdata_escape }}]]></content>
</entry>
{% endfor %}
</feed>

16
_layouts/tag_index.html Normal file
View File

@ -0,0 +1,16 @@
---
layout: page
title: Posts tagged "{{ page.tag }}"
---
{% for post in site.tags[page.tag] reverse %}
{% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %}
{% unless year == this_year %}
{% assign year = this_year %}
<h3>{{ year }}</h3>
{% endunless %}
<div>
<time datetime="{{ post.date | datetime | date_to_xmlschema }}" pubdate>{{ post.date | date: "%B %d" }}</time> &mdash;
<a href="/{{ post.url }}">{{post.title}}</a>
</div>
{% endfor %}
<p><a href="/tag/{{ page.tag }}/atom.xml">subscribe</a></p>

90
_plugins/tag_index.rb Normal file
View File

@ -0,0 +1,90 @@
module Jekyll
class TagIndex < Page
def initialize(site, base, dir, tag)
@site = site
@base = base
@dir = dir
@name = 'index.html'
self.process(@name)
self.read_yaml(File.join(base, '_layouts'), 'tag_index.html')
self.data['tag'] = tag
tag_title_prefix = site.config['tag_title_prefix'] || 'Posts Tagged &ldquo;'
tag_title_suffix = site.config['tag_title_suffix'] || '&rdquo;'
self.data['title'] = "#{tag_title_prefix}#{tag}#{tag_title_suffix}"
end
end
class TagFeed < Page
def initialize(site, base, tag_dir, tag)
@site = site
@base = base
@dir = tag_dir
@name = 'atom.xml'
self.process(@name)
# Read the YAML data from the layout page.
self.read_yaml(File.join(base, '_layouts'), 'tag_feed.xml')
self.data['tag'] = tag
# Set the title for this page.
tag_title_prefix = site.config['tag_title_prefix'] || 'Posts Tagged &ldquo;'
tag_title_suffix = site.config['tag_title_suffix'] || '&rdquo;'
self.data['title'] = "#{tag_title_prefix}#{tag}#{tag_title_suffix}"
# Set the meta-description for this page.
# Set the correct feed URL.
self.data['feed_url'] = "#{tag_dir}/#{name}"
end
end
class TagGenerator < Generator
safe true
def generate(site)
if site.layouts.key? 'tag_index'
dir = site.config['tag_dir'] || 'tag'
site.tags.keys.each do |tag|
write_tag_index(site, File.join(dir, tag), tag)
write_tag_feed(site, File.join(dir, tag), tag)
end
end
end
def write_tag_index(site, dir, tag)
index = TagIndex.new(site, site.source, dir, tag)
index.render(site.layouts, site.site_payload)
index.write(site.dest)
site.pages << index
end
def write_tag_feed(site, dir, tag)
feed = TagFeed.new(site, site.source, dir, tag)
feed.render(site.layouts, site.site_payload)
feed.write(site.dest)
site.pages << feed
end
end
# Adds some extra filters used during the category creation process.
module Filters
# Outputs a list of categories as comma-separated <a> links. This is used
# to output the category list for each post on a category page.
#
# +categories+ is the list of categories to format.
#
# Returns string
#
def tag_links(tags)
tags = tags.sort!.map do |item|
"<a class='tag' href='/tag/#{item}/'>#{item}</a>"
end
case tags.length
when 0
""
when 1
tags[0].to_s
else
"#{tags[0...-1].join(', ')}, #{tags[-1]}"
end
end
end
end

26
atom.xml Normal file
View File

@ -0,0 +1,26 @@
---
layout: nil
---
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[{{ site.title }}]]></title>
<link href="{{ site.url }}/atom.xml" rel="self"/>
<link href="{{ site.url }}/"/>
<updated>{{ site.time | date_to_xmlschema }}</updated>
<id>{{ site.url }}/</id>
<author>
<name><![CDATA[{{ site.author | strip_html }}]]></name>
{% if site.email %}<email><![CDATA[{{ site.email }}]]></email>{% endif %}
</author>
{% for post in site.posts limit: 20 %}
<entry>
<title type="html"><![CDATA[{{ post.title | cdata_escape }}]]></title>
<link href="{{ site.url }}/{{ post.url }}"/>
<updated>{{ post.date | date_to_xmlschema }}</updated>
<id>{{ site.url }}/{{ post.id }}</id>
<content type="html"><![CDATA[{{ post.content | expand_urls: site.url | cdata_escape }}]]></content>
</entry>
{% endfor %}
</feed>

15
blog/index.html Normal file
View File

@ -0,0 +1,15 @@
---
layout: page
title: Blog Archive
---
{% for post in site.posts reverse %}
{% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %}
{% unless year == this_year %}
{% assign year = this_year %}
<h3>{{ year }}</h3>
{% endunless %}
<div>
<time datetime="{{ post.date | datetime | date_to_xmlschema }}" pubdate>{{ post.date | date: "%B %d" }}</time> &mdash;
<a href="/{{ post.url }}">{{post.title}}</a>
</div>
{% endfor %}

BIN
favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

10
index.html Normal file
View File

@ -0,0 +1,10 @@
---
layout: default
title: striving towards mediocrity
---
{% for post in site.posts limit: 1 %}
{% assign content = post.content %}
{% include post.html %}
{% endfor %}
{% include vcard.html %}

BIN
stylesheets/Typewriter.otf Normal file

Binary file not shown.

196
stylesheets/screen.css Normal file
View File

@ -0,0 +1,196 @@
@font-face {
font-family: Typewriter;
src: url(Typewriter.otf) format("opentype");
}
/* Resets
------ */
html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6,
p, blockquote, pre, a, abbr, address, cite, code, del, dfn, em,
img, ins, kbd, q, samp, small, strong, sub, sup, var, b, i, hr,
dl, dt, dd, ol, ul, li, fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, figure, figcaption, hgroup,
menu, footer, header, nav, section, summary, time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
}
article, aside, canvas, figure, figure img, figcaption, hgroup,
footer, header, nav, section, audio, video {
display: block;
}
a {
text-decoration: none;
}
body {
color: #343434;
margin: 0 auto;
background: #ffffff;
font-family: PT Serif, Georgia, serif;
font-size: 18px;
width: 712px;
padding: 48px 48px 84px;
margin: 0 auto;
}
h1 {
font-size: 48px;
line-height: 58px;
}
h2 {
font-size: 32px;
line-height: 36px;
}
h3 {
font-size: 24px;
line-height: 32px;
}
img.left {
float: left;
margin: 0 1em 1em 0;
}
img.right {
float: right;
margin: 0 0 1em 1em;
}
header h1, header h2 {
display: inline;
font-family: Typewriter,"Georgia","Times",serif;
font-weight: normal;
padding-right: 10px;
}
header h1 a {
color: #343434;
}
header h2 {
color: #676767;
}
nav {
margin: 1em 0;
padding: 0 0 1em 0;
text-transform: uppercase;
border-bottom: 1px solid #dedede;
}
nav ul.navigation {
border-left: 4px solid #dedede;
padding-left: 0.5em;
}
nav ul.navigation li {
display: inline;
list-style-type: none;
padding: 0 1em 0 0;
font-size: 16px;
}
nav ul.navigation li a {
color: #303030;
}
/** Article styles **/
article header h1 {
display: block;
font-size: 32px;
line-height: 36px;
margin-bottom: 1em;
text-transform: lowercase;
}
article p {
text-align: justify;
margin: 0.5em 0 1em 0;
}
article pre {
background: #000;
color: #fff;
padding: 10px;
}
article ul, article ol {
margin-left: 2em;
}
article footer time {
display: block;
text-align: right;
}
footer {
margin: 1em 0;
font-size: 16px;
}
.vcard {
border-top: 1px #dedede solid;
border-bottom: 1px #dedede solid;
padding: 10px 0;
}
.vcard p {
font-size: 16px;
margin-bottom: 0.5em;
}
.vcard img {
float: left;
margin: 0 0.5em 0 0;
border: 1px #dedede solid;
padding: 3px;
}
@media only screen and (min-width: 768px) and (max-width: 991px) {
body {
width: 712px;
padding: 48px 28px 60px;
}
#main {
528px;
}
}
@media only screen and (max-width: 767px) {
body {
width: 252px;
padding: 48px 34px 60px;
}
body>header h2 {
display: none;
}
#main {
width: 252px;
}
}
@media only screen and (min-width: 480px) and (max-width: 767px) {
body {
width: 436px;
padding: 36px 22px 48px;
}
#main {
width: 436px;
}
}