Redirects for old spec URLs

This commit is contained in:
str4d
2016-03-06 01:44:09 +00:00
parent 3858bbab69
commit b16fb65a89

View File

@ -12,11 +12,22 @@ from i2p2www.blog.helpers import get_blog_posts
def main_index():
return redirect(url_for('site_show', lang='en'))
SPEC_REDIRECTS = {
'docs/how/cryptography': 'cryptography',
}
# Site pages
@cache.cached()
def site_show(page):
if page.endswith('.html'):
return redirect(url_for('site_show', page=page[:-5]))
# Redirect for old spec pages
if page.startswith('docs/spec/'):
return redirect(url_for('spec_show', name=page[10:]))
if page in SPEC_REDIRECTS:
return redirect(url_for('spec_show', name=SPEC_REDIRECTS[page]))
name = 'site/%s.html' % page
page_file = safe_join(TEMPLATE_DIR, name)