-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.rb
33 lines (28 loc) · 839 Bytes
/
app.rb
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
# Use the app.rb file to load Ruby code, modify or extend the models, or
# do whatever else you fancy when the theme is loaded.
Encoding.default_external = 'utf-8'
require 'rack/codehighlighter'
module Nesta
class App
# use Rack::Static, :urls => ["/fg"], :root => "themes/fg/public"
use Rack::Codehighlighter, :coderay, :markdown => true,
:element => "pre>code",
:pattern => /\A:::(\w+)\s*(\n|
)/i,
:logging => false
helpers do
# Add new helpers here.
def latest_articles
Nesta::Page.find_articles
end
end
# Add new routes here.
# redirect old links with timestamp path
get %r{/\d{4}/\d{2}/\d{2}/([\w/.-]+)} do |page|
if page =~ /filter-table-plugin/
redirect "/projects/#{page}", 301
else
redirect "/blog/#{page}", 301
end
end
end
end