blog config ready
This commit is contained in:
1
Gemfile
1
Gemfile
@ -3,6 +3,7 @@ source "https://rubygems.org"
|
|||||||
gem "middleman", "~>3.3"
|
gem "middleman", "~>3.3"
|
||||||
gem "awesome_print"
|
gem "awesome_print"
|
||||||
gem "json", '~> 1.8'
|
gem "json", '~> 1.8'
|
||||||
|
gem 'nokogiri'
|
||||||
|
|
||||||
gem "middleman-favicon-maker" # https://github.com/follmann/middleman-favicon-maker
|
gem "middleman-favicon-maker" # https://github.com/follmann/middleman-favicon-maker
|
||||||
gem "middleman-livereload"
|
gem "middleman-livereload"
|
||||||
|
@ -90,8 +90,11 @@ GEM
|
|||||||
sprockets (~> 2.12.1)
|
sprockets (~> 2.12.1)
|
||||||
sprockets-helpers (~> 1.1.0)
|
sprockets-helpers (~> 1.1.0)
|
||||||
sprockets-sass (~> 1.2.0)
|
sprockets-sass (~> 1.2.0)
|
||||||
|
mini_portile (0.5.2)
|
||||||
minitest (5.4.1)
|
minitest (5.4.1)
|
||||||
multi_json (1.10.1)
|
multi_json (1.10.1)
|
||||||
|
nokogiri (1.6.1)
|
||||||
|
mini_portile (~> 0.5.0)
|
||||||
padrino-helpers (0.12.3)
|
padrino-helpers (0.12.3)
|
||||||
i18n (~> 0.6, >= 0.6.7)
|
i18n (~> 0.6, >= 0.6.7)
|
||||||
padrino-support (= 0.12.3)
|
padrino-support (= 0.12.3)
|
||||||
@ -139,4 +142,5 @@ DEPENDENCIES
|
|||||||
middleman-blog
|
middleman-blog
|
||||||
middleman-favicon-maker
|
middleman-favicon-maker
|
||||||
middleman-livereload
|
middleman-livereload
|
||||||
|
nokogiri
|
||||||
redcarpet
|
redcarpet
|
||||||
|
@ -50,7 +50,10 @@ after_configuration do
|
|||||||
end
|
end
|
||||||
|
|
||||||
activate :blog do |blog|
|
activate :blog do |blog|
|
||||||
# set options on blog
|
blog.paginate = true
|
||||||
|
blog.layout = "layouts/blog.html"
|
||||||
|
blog.tag_template = "tag.html"
|
||||||
|
blog.sources = "blog/{title}.html"
|
||||||
end
|
end
|
||||||
|
|
||||||
#video pages
|
#video pages
|
||||||
@ -58,6 +61,8 @@ data.video.keys.each do |vdo|
|
|||||||
proxy "video/#{vdo}.html", 'video/template.html', locals: {video: data.video[vdo]}, ignore: true
|
proxy "video/#{vdo}.html", 'video/template.html', locals: {video: data.video[vdo]}, ignore: true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
activate :directory_indexes
|
||||||
|
|
||||||
# Build-specific configuration
|
# Build-specific configuration
|
||||||
configure :build do
|
configure :build do
|
||||||
# For example, change the Compass output style for deployment
|
# For example, change the Compass output style for deployment
|
||||||
|
12
source/blog/a-fresh-start.html.haml
Normal file
12
source/blog/a-fresh-start.html.haml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
title: A Fresh Start
|
||||||
|
poster: /assets/img/star_nasa.jpg
|
||||||
|
date: 2014-09-16
|
||||||
|
tags: example
|
||||||
|
---
|
||||||
|
|
||||||
|
.spacer-100
|
||||||
|
.row
|
||||||
|
.col-sm-12
|
||||||
|
A new thing
|
||||||
|
|
@ -1,33 +0,0 @@
|
|||||||
---
|
|
||||||
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 %>
|
|
@ -1,24 +0,0 @@
|
|||||||
---
|
|
||||||
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 %>
|
|
@ -1,38 +0,0 @@
|
|||||||
<!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>
|
|
@ -1,25 +0,0 @@
|
|||||||
---
|
|
||||||
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 %>
|
|
25
source/calendar.html.haml
Normal file
25
source/calendar.html.haml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
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
|
||||||
|
- if paginate && num_pages > 1
|
||||||
|
%p
|
||||||
|
Page #{page_number} of #{num_pages}
|
||||||
|
- if prev_page
|
||||||
|
%p= link_to 'Previous page', prev_page
|
||||||
|
%ul
|
||||||
|
- page_articles.each_with_index do |article, i|
|
||||||
|
%li
|
||||||
|
= link_to article.title, article
|
||||||
|
%span= article.date.strftime('%b %e')
|
||||||
|
- if paginate
|
||||||
|
- if next_page
|
||||||
|
%p= link_to 'Next page', next_page
|
@ -1,8 +1,20 @@
|
|||||||
---
|
---
|
||||||
title: A Fresh Start
|
pageable: true
|
||||||
poster: /assets/img/star_nasa.jpg
|
per_page: 10
|
||||||
|
poster: /assets/img/bg/tree_bark.png
|
||||||
---
|
---
|
||||||
.spacer-100
|
|
||||||
.row
|
|
||||||
.col-sm-12
|
- if paginate && num_pages > 1
|
||||||
A new thing
|
%p
|
||||||
|
Page #{page_number} of #{num_pages}
|
||||||
|
- if prev_page
|
||||||
|
%p= link_to 'Previous page', prev_page
|
||||||
|
- page_articles.each_with_index do |article, i|
|
||||||
|
%h2
|
||||||
|
= link_to article.title, article
|
||||||
|
= article.summary(250)
|
||||||
|
|
||||||
|
- if paginate
|
||||||
|
- if next_page
|
||||||
|
%p= link_to 'Next page', next_page
|
||||||
|
48
source/layouts/blog.html.haml
Normal file
48
source/layouts/blog.html.haml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
!!!
|
||||||
|
/[if lt IE 7] <html class="no-js lt-ie9 lt-ie8 lt-ie7">
|
||||||
|
/ [if IE 7] <html class="no-js lt-ie9 lt-ie8"> <![endif]
|
||||||
|
/ [if IE 8] <html class="no-js lt-ie9"><![endif]
|
||||||
|
%html
|
||||||
|
%head
|
||||||
|
%meta{charset: "utf-8"}/
|
||||||
|
%meta{content: "IE=edge,chrome=1", "http-equiv" => "X-UA-Compatible"}/
|
||||||
|
%meta{content: "width=device-width,initial-scale=1.0", name: "viewport"}/
|
||||||
|
%meta{content: page_description, name: "description"}/
|
||||||
|
%meta{content: page_keywords, name: "keywords"}/
|
||||||
|
= feed_tag :atom, "#{blog.options.prefix.to_s}/feed.xml", title: "Atom Feed"
|
||||||
|
%title
|
||||||
|
= page_title
|
||||||
|
- # Blog Title#{' - ' + current_article.title unless current_article.nil?}
|
||||||
|
= stylesheet_link_tag "all"
|
||||||
|
= javascript_include_tag "vendor/modernizr"
|
||||||
|
= partial "shared/analytics"
|
||||||
|
= yield_content :head
|
||||||
|
|
||||||
|
%body{class: page_classes}
|
||||||
|
/[if lt IE 8]
|
||||||
|
<haml_loud> partial "shared/compatibility-notice" </haml_loud>
|
||||||
|
= partial "shared/header"
|
||||||
|
- if current_page.data.poster.present?
|
||||||
|
.poster
|
||||||
|
= tag :img, src: current_page.data.poster
|
||||||
|
.container
|
||||||
|
.row
|
||||||
|
.col-sm-9#main{:role => "main"}
|
||||||
|
= yield
|
||||||
|
.col-sm-3
|
||||||
|
.spacer-50
|
||||||
|
.side-links
|
||||||
|
%ul
|
||||||
|
%li.bolder Recent Posts
|
||||||
|
- blog.articles[0...10].each do |article|
|
||||||
|
%li
|
||||||
|
= link_to article.title, article
|
||||||
|
|
||||||
|
%ul
|
||||||
|
%li Tags
|
||||||
|
- blog.tags.each do |tag, articles|
|
||||||
|
%li= link_to "#{tag}", tag_path(tag)
|
||||||
|
|
||||||
|
.spacer-50
|
||||||
|
|
||||||
|
= javascript_include_tag "app"
|
@ -20,7 +20,7 @@
|
|||||||
= partial "shared/header"
|
= partial "shared/header"
|
||||||
- if current_page.data.poster.present?
|
- if current_page.data.poster.present?
|
||||||
.poster
|
.poster
|
||||||
= tag :img, src: current_page.data.poster
|
= tag :img, src: current_page.data.poster, style: 'background-repeat:repeat-y;width: 100%; height: 200px;'
|
||||||
.container
|
.container
|
||||||
= yield
|
= yield
|
||||||
.spacer-50
|
.spacer-50
|
||||||
|
19
source/tag.html.haml
Normal file
19
source/tag.html.haml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
pageable: true
|
||||||
|
per_page: 10
|
||||||
|
---
|
||||||
|
%h1
|
||||||
|
Articles tagged '#{tagname}'
|
||||||
|
- if paginate && num_pages > 1
|
||||||
|
%p
|
||||||
|
Page #{page_number} of #{num_pages}
|
||||||
|
- if prev_page
|
||||||
|
%p= link_to 'Previous page', prev_page
|
||||||
|
%ul
|
||||||
|
- page_articles.each_with_index do |article, i|
|
||||||
|
%li
|
||||||
|
= link_to article.title, article
|
||||||
|
|
||||||
|
- if paginate
|
||||||
|
- if next_page
|
||||||
|
%p= link_to 'Next page', next_page
|
Reference in New Issue
Block a user