blob: 14a81eb2dd631e92d41b8467cff3a8690b96013d (
plain)
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
34
35
36
37
38
39
|
from kyrias_website import app, pages, journal
from flask import render_template
# Render all static pages as fallback
@app.route('/<path:path>/')
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/<path:name>/')
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)
|