Skip to content

Instantly share code, notes, and snippets.

@oncomouse
Created August 15, 2013 05:00
Show Gist options
  • Save oncomouse/6238377 to your computer and use it in GitHub Desktop.
Save oncomouse/6238377 to your computer and use it in GitHub Desktop.
Portion of a Middleman config.rb file relevant to getting middleman-blog working.
set :markdown_engine, :kramdown
set :markdown, :fenced_code_blocks => true,
:autolink => true,
:smartypants => true,
:footnotes => true,
:superscript => true
helpers do
def javascript_path(file_path)
asset_path(:js, file_path)
end
end
class Middleman::Sitemap::Resource
def first_paragraph
nokogiri_doc = Nokogiri::HTML(self.body)
return nokogiri_doc.css("p").first.to_s
end
end
page "/blog/*", :layout => :blog_article
activate :blog do |blog|
blog.prefix = "blog/"
blog.sources = ":year-:month-:day-:title.html"
blog.layout = "blog_article"
blog.tag_template = "blog/tag.html"
blog.calendar_template = "blog/calendar.html"
blog.paginate = true
blog.per_page = 10
end
# This line has to be after blog configuration:
activate :directory_indexes
activate :deploy do |deploy|
# Deploy via SSH:
deploy.method = :rsync
deploy.user = "username"
deploy.host = "server.host.com"
deploy.path = "~/site/directory/"
# Deploy via Git Pages:
# deploy.method = :git
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment