blog init
This commit is contained in:
7
source/blog/2012-01-01-example-article.html.markdown
Normal file
7
source/blog/2012-01-01-example-article.html.markdown
Normal file
@ -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!
|
33
source/blog/calendar.html.erb
Normal file
33
source/blog/calendar.html.erb
Normal file
@ -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 %>
|
24
source/blog/feed.xml.builder
Normal file
24
source/blog/feed.xml.builder
Normal file
@ -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
|
24
source/blog/index.html.erb
Normal file
24
source/blog/index.html.erb
Normal file
@ -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 %>
|
38
source/blog/layout.erb
Normal file
38
source/blog/layout.erb
Normal file
@ -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>
|
25
source/blog/tag.html.erb
Normal file
25
source/blog/tag.html.erb
Normal file
@ -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 %>
|
Reference in New Issue
Block a user