-
Notifications
You must be signed in to change notification settings - Fork 41
/
config.ru
35 lines (28 loc) · 834 Bytes
/
config.ru
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
require 'rubygems'
require 'bundler/setup'
Bundler.require(:default)
# The project root directory
root = ::File.dirname(__FILE__)
# Code highlighting
require 'pygments'
require 'rack/codehighlighter'
use Rack::Codehighlighter, :pygments, :element => "pre>code", :markdown => true
# Cache control headers for Heroku
require 'rack/contrib'
use Rack::ResponseHeaders do |headers|
headers['Cache-Control'] = 'public, max-age=1501'
end
use Rack::ETag
# Google analytics
require "rack/google_analytics"
use Rack::GoogleAnalytics, web_property_id: "UA-4556641-15"
# URL rewriting
require 'rack/rewrite'
use Rack::Rewrite do
# Articles -> Editorial
r301 %r{^/articles(?!\.xml)(.*)$}, '/editorial$1'
# Remove and 301 redirect trailing slashes in URLs
r301 %r{^/(.*)/$}, '/$1'
end
require 'middleman/rack'
run Middleman.server