Path names for articles

This commit is contained in:
Stefan Schlott 2013-08-24 11:04:18 +02:00
parent 81e67956fb
commit a0163068af
2 changed files with 38 additions and 0 deletions

18
Rules
View file

@ -67,6 +67,24 @@ route "/htaccess" do
"/.htaccess"
end
route '/articles/*' do
# Find corresponding article (for getting metadata)
articleitem = article_base_item(item)
if articleitem
# Create directory basename
url = '/' + pathname_of_article(articleitem)
# Main article goes to index.html, don't touch other filenames
if item.equal? articleitem then
url + '/index.html'
else
idparts = item.identifier.split('/')
url + "/#{idparts.last}.#{item[:extension]}"
end
else
nil
end
end
route '*' do
if item.binary?
item.identifier.chop + '.' + item[:extension]