blog init

This commit is contained in:
Mark Moser
2014-09-15 21:57:01 -05:00
parent 2add7ee700
commit a938f7e29b
23 changed files with 208 additions and 1 deletions

View File

@ -4,7 +4,8 @@ gem "middleman", "~>3.3"
gem "awesome_print"
gem "json", '~> 1.8'
gem "middleman-favicon-maker"
gem "middleman-favicon-maker" # https://github.com/follmann/middleman-favicon-maker
gem "middleman-livereload"
gem "middleman-blog"
gem "redcarpet"

View File

@ -7,6 +7,7 @@ GEM
minitest (~> 5.1)
thread_safe (~> 0.1)
tzinfo (~> 1.1)
addressable (2.3.6)
awesome_print (1.2.0)
celluloid (0.15.2)
timers (~> 1.1.0)
@ -61,6 +62,10 @@ GEM
middleman-sprockets (>= 3.1.2)
sass (>= 3.2.17, < 4.0)
uglifier (~> 2.5)
middleman-blog (3.5.3)
addressable (~> 2.3.5)
middleman-core (~> 3.2)
tzinfo (>= 0.3.0)
middleman-core (3.3.5)
activesupport (~> 4.1.0)
bundler (~> 1.1)
@ -131,6 +136,7 @@ DEPENDENCIES
awesome_print
json (~> 1.8)
middleman (~> 3.3)
middleman-blog
middleman-favicon-maker
middleman-livereload
redcarpet

View File

@ -49,6 +49,10 @@ after_configuration do
sprockets.append_path File.join "#{root}", @bower_config["directory"]
end
activate :blog do |blog|
# set options on blog
end
#video pages
data.video.keys.each do |vdo|
proxy "video/#{vdo}.html", 'video/template.html', locals: {video: data.video[vdo]}, ignore: true

View 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!

View 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 %>

View 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

View 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
View 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
View 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 %>

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 865 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 513 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 KiB

View File

@ -0,0 +1,45 @@
---
title: Video
---
.spacer-50
.row
.col-sm-12
%h3= video.title
.row
.col-sm-12
.player
- if video.vimeo?
= video.vimeo
- else
:ruby
options = {
src: "/video/#{video.file}",
style:"width:#{video.width}px; height:#{video.height}px",
poster: "/video/#{video.poster}",
}
%video{video.options.merge(options)}
.row
.col-sm-12
- if video.note
%p= video.note
- if video.role?
%p My Role: #{video.role}
- if video.credit
%p
Credits:
%br
= video.credit
.row
.col-sm-12
.side-links
%ul
%li More Videos:
- data.video.each do |vdo, video|
%li= link_to video.title, "#{vdo}.html"