summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorLars Henrik Mai <lars.mai@kontinui.de>2014-04-08 13:58:00 +0200
committerLars Henrik Mai <lars.mai@kontinui.de>2014-04-08 13:58:00 +0200
commitb0da6603c012280a33202836bb1e9a2456fbd054 (patch)
tree960d807a49c79f210b7307e87ce43ddf8524038d /source
parent3b2ecefb6b3f763762f191452e40c59fb7f58ec5 (diff)
initialized blog extensions
Diffstat (limited to 'source')
-rw-r--r--source/2012-01-01-example-article.html.markdown7
-rw-r--r--source/calendar.html.erb33
-rw-r--r--source/feed.xml.builder24
-rw-r--r--source/index.html.erb24
-rw-r--r--source/layout.erb38
-rw-r--r--source/tag.html.erb25
6 files changed, 151 insertions, 0 deletions
diff --git a/source/2012-01-01-example-article.html.markdown b/source/2012-01-01-example-article.html.markdown
new file mode 100644
index 0000000..618d7f3
--- /dev/null
+++ b/source/2012-01-01-example-article.html.markdown
@@ -0,0 +1,7 @@
+---
+title: Example Article
+date: 2012-01-01
+tags: example
+---
+
+This is an example article. You probably want to delete it and write your own articles!
diff --git a/source/calendar.html.erb b/source/calendar.html.erb
new file mode 100644
index 0000000..4cdfdf9
--- /dev/null
+++ b/source/calendar.html.erb
@@ -0,0 +1,33 @@
+---
+pageable: true
+---
+<h1>Archive for
+ <% case page_type
+ when 'day' %>
+ <%= Date.new(year, month, day).strftime('%b %e %Y') %>
+ <% when 'month' %>
+ <%= Date.new(year, month, 1).strftime('%b %Y') %>
+ <% when 'year' %>
+ <%= year %>
+ <% end %>
+</h1>
+
+<% if paginate && num_pages > 1 %>
+ <p>Page <%= page_number %> of <%= num_pages %></p>
+
+ <% if prev_page %>
+ <p><%= link_to 'Previous page', prev_page %></p>
+ <% end %>
+<% end %>
+
+<ul>
+ <% page_articles.each_with_index do |article, i| %>
+ <li><%= link_to article.title, article %> <span><%= article.date.strftime('%b %e') %></span></li>
+ <% end %>
+</ul>
+
+<% if paginate %>
+ <% if next_page %>
+ <p><%= link_to 'Next page', next_page %></p>
+ <% end %>
+<% end %>
diff --git a/source/feed.xml.builder b/source/feed.xml.builder
new file mode 100644
index 0000000..6fa9c08
--- /dev/null
+++ b/source/feed.xml.builder
@@ -0,0 +1,24 @@
+xml.instruct!
+xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
+ site_url = "http://blog.url.com/"
+ xml.title "Blog Name"
+ xml.subtitle "Blog subtitle"
+ xml.id URI.join(site_url, blog.options.prefix.to_s)
+ xml.link "href" => URI.join(site_url, blog.options.prefix.to_s)
+ xml.link "href" => URI.join(site_url, current_page.path), "rel" => "self"
+ xml.updated(blog.articles.first.date.to_time.iso8601) unless blog.articles.empty?
+ xml.author { xml.name "Blog Author" }
+
+ blog.articles[0..5].each do |article|
+ xml.entry do
+ xml.title article.title
+ xml.link "rel" => "alternate", "href" => URI.join(site_url, article.url)
+ xml.id URI.join(site_url, article.url)
+ xml.published article.date.to_time.iso8601
+ xml.updated File.mtime(article.source_file).iso8601
+ xml.author { xml.name "Article Author" }
+ # xml.summary article.summary, "type" => "html"
+ xml.content article.body, "type" => "html"
+ end
+ end
+end
diff --git a/source/index.html.erb b/source/index.html.erb
new file mode 100644
index 0000000..0fae27e
--- /dev/null
+++ b/source/index.html.erb
@@ -0,0 +1,24 @@
+---
+pageable: true
+per_page: 10
+---
+<% if paginate && num_pages > 1 %>
+ <p>Page <%= page_number %> of <%= num_pages %></p>
+
+ <% if prev_page %>
+ <p><%= link_to 'Previous page', prev_page %></p>
+ <% end %>
+<% end %>
+
+<% page_articles.each_with_index do |article, i| %>
+ <h2><%= link_to article.title, article %> <span><%= article.date.strftime('%b %e') %></span></h2>
+ <!-- use article.summary(250) if you have Nokogiri available to show just
+ the first 250 characters -->
+ <%= article.body %>
+<% end %>
+
+<% if paginate %>
+ <% if next_page %>
+ <p><%= link_to 'Next page', next_page %></p>
+ <% end %>
+<% end %>
diff --git a/source/layout.erb b/source/layout.erb
new file mode 100644
index 0000000..36c3da9
--- /dev/null
+++ b/source/layout.erb
@@ -0,0 +1,38 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8" />
+ <meta http-equiv='X-UA-Compatible' content='IE=edge;chrome=1' />
+ <title>Blog Title<%= ' - ' + current_article.title unless current_article.nil? %></title>
+ <%= feed_tag :atom, "#{blog.options.prefix.to_s}/feed.xml", title: "Atom Feed" %>
+ </head>
+ <body>
+
+ <div id="main" role="main">
+ <%= yield %>
+ </div>
+
+ <aside>
+ <h2>Recent Articles</h2>
+ <ol>
+ <% blog.articles[0...10].each do |article| %>
+ <li><%= link_to article.title, article %> <span><%= article.date.strftime('%b %e') %></span></li>
+ <% end %>
+ </ol>
+
+ <h2>Tags</h2>
+ <ol>
+ <% blog.tags.each do |tag, articles| %>
+ <li><%= link_to "#{tag} (#{articles.size})", tag_path(tag) %></li>
+ <% end %>
+ </ol>
+
+ <h2>By Year</h2>
+ <ol>
+ <% blog.articles.group_by {|a| a.date.year }.each do |year, articles| %>
+ <li><%= link_to "#{year} (#{articles.size})", blog_year_path(year) %></li>
+ <% end %>
+ </ol>
+ </aside>
+ </body>
+</html>
diff --git a/source/tag.html.erb b/source/tag.html.erb
new file mode 100644
index 0000000..c28a20b
--- /dev/null
+++ b/source/tag.html.erb
@@ -0,0 +1,25 @@
+---
+pageable: true
+per_page: 12
+---
+<h1>Articles tagged '<%= tagname %>'</h1>
+
+<% if paginate && num_pages > 1 %>
+ <p>Page <%= page_number %> of <%= num_pages %></p>
+
+ <% if prev_page %>
+ <p><%= link_to 'Previous page', prev_page %></p>
+ <% end %>
+<% end %>
+
+<ul>
+ <% page_articles.each_with_index do |article, i| %>
+ <li><%= link_to article.title, article %> <span><%= article.date.strftime('%b %e') %></span></li>
+ <% end %>
+</ul>
+
+<% if paginate %>
+ <% if next_page %>
+ <p><%= link_to 'Next page', next_page %></p>
+ <% end %>
+<% end %>