-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Furthermore, redirect the index page to `/news/`
- Loading branch information
1 parent
37a01e7
commit 6fc51ec
Showing
2 changed files
with
28 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
""" | ||
Blueprint providing features regarding the news entries. | ||
""" | ||
|
||
from flask import Blueprint, render_template | ||
from sipa.flatpages import cf_pages | ||
|
||
bp_news = Blueprint('news', __name__, url_prefix='/news') | ||
|
||
|
||
@bp_news.route("/") | ||
def display(): | ||
"""Get all markdown files from 'content/news/', parse them and put | ||
them in a list for the template. | ||
The formatting of these files is described in the readme. | ||
""" | ||
cf_pages.reload() | ||
latest = cf_pages.get_articles_of_category('news') | ||
latest = sorted(latest, key=lambda a: a.date, reverse=True) | ||
latest = latest[0:10] | ||
return render_template("index.html", articles=latest) | ||
|