from kyrias_website import app, pages, journal from flask import render_template # Render all static pages as fallback @app.route('//') def page(path): page = pages.get_or_404(path) return render_template('page.html', page=page) @app.route('/blog/') @app.route('/index/') @app.route('/') def index(): current = journal.entries[-1] older = next(iter(journal.entries[-2:-1]), None) return render_template('entry.html', entry=current, older=older) @app.route('/archive/') def archive(): return render_template('archive.html', entries=journal.entries) @app.route('/tags/') def tags(): return render_template('tags.html', tags=journal.tags) @app.route('/blog//') def entry(name): entry = journal.get_or_404(name) index = journal.entries.index(entry) older = next(iter(journal.entries[index-1:index]), None) newer = next(iter(journal.entries[index+1:index+2]), None) return render_template('entry.html', entry=entry, older=older, newer=newer)