Init
This commit is contained in:
commit
72067ba038
19 changed files with 7758 additions and 0 deletions
76
Rules
Normal file
76
Rules
Normal file
|
@ -0,0 +1,76 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
preprocess do
|
||||
create_robots_txt
|
||||
create_webmaster_tools_authentications
|
||||
create_sitemap
|
||||
end
|
||||
|
||||
compile '/assets/css/*' do
|
||||
filter :cache_buster
|
||||
filter :rainpress
|
||||
end
|
||||
|
||||
route %r{^/(assets/.*|sitemap|robots|atom)/$} do
|
||||
next nil if item.identifier.split('/')[-1][0,1] == '_' # partial
|
||||
|
||||
fp = cachebust?(item) ? fingerprint(item[:filename]) : ''
|
||||
item.identifier.chop + fp + '.' + item[:extension]
|
||||
end
|
||||
|
||||
compile '/sitemap/' do
|
||||
filter :erb
|
||||
end
|
||||
|
||||
compile '/sitemap/', rep: 'gzip' do
|
||||
filter :erb
|
||||
filter :shellcmd, cmd: 'gzip'
|
||||
end
|
||||
|
||||
route '/sitemap/', rep: 'gzip' do
|
||||
'/sitemap.xml.gz'
|
||||
end
|
||||
|
||||
compile '/posts/feed/' do
|
||||
filter :erb
|
||||
end
|
||||
|
||||
route '/posts/feed/' do
|
||||
'/posts.xml'
|
||||
end
|
||||
|
||||
compile %r{^/(google|robots|assets|favicon)} do
|
||||
end
|
||||
|
||||
compile '*' do
|
||||
case item[:extension]
|
||||
when 'slim'
|
||||
filter :slim
|
||||
when 'md'
|
||||
filter :redcarpet, renderer: MarkdownHTML, options: { fenced_code_blocks: true }
|
||||
end
|
||||
|
||||
case item.identifier
|
||||
when %r{^/posts/}
|
||||
layout 'post'
|
||||
else
|
||||
layout 'default'
|
||||
end
|
||||
|
||||
filter :cache_buster
|
||||
end
|
||||
|
||||
route '/' do
|
||||
'/index.html'
|
||||
end
|
||||
|
||||
route '*' do
|
||||
if item.binary?
|
||||
# Write item with identifier /foo/ to /foo.ext
|
||||
item.identifier.chop + '.' + item[:extension]
|
||||
else
|
||||
item.identifier.chop + '.html'
|
||||
end
|
||||
end
|
||||
|
||||
layout '*', :slim
|
Loading…
Add table
Add a link
Reference in a new issue