diff --git a/www.i2p2/i2p2www/__init__.py b/www.i2p2/i2p2www/__init__.py index c1644d0a97af5fa3f056c10623bd679090783dae..6526416cc8f486138a4e1270a4ef3d54daac9bc6 100644 --- a/www.i2p2/i2p2www/__init__.py +++ b/www.i2p2/i2p2www/__init__.py @@ -221,18 +221,19 @@ def get_blog_index(): """ Returns list of valid slugs sorted by date """ - ret=[] - - # list of slugs(not sorted in any way) + # list of slugs entries=[] # walk over all directories/files for v in os.walk(BLOG_DIR): # iterate over all files + slugbase = os.path.relpath(v[0], BLOG_DIR) for f in v[2]: # ignore all non-.rst files if not f.endswith('.rst'): continue - + entries.append(safe_join(slugbase, f[:-4])) + entries.sort() + return entries def render_blog_entry(slug): """ @@ -260,7 +261,9 @@ def render_blog_entry(slug): @app.route('/<string:lang>/blog/page/<int:page>') def blog_index(page=0): # TODO: implement - pass + entries = get_blog_index() + + return render_template('blog/index.html', entries=entries) @app.route('/<string:lang>/blog/entry/<path:slug>') def blog_entry(slug): diff --git a/www.i2p2/i2p2www/pages/blog/index.html b/www.i2p2/i2p2www/pages/blog/index.html new file mode 100644 index 0000000000000000000000000000000000000000..da8833238f09cc3cd370749552ec1b00b7c888d4 --- /dev/null +++ b/www.i2p2/i2p2www/pages/blog/index.html @@ -0,0 +1,10 @@ +{% extends "global/layout.html" %} +{% block title %}Blog Index{% endblock %} +{% block content %} +<p>Some descriptive text.</p> +<ul class="infolist"> +{% for entry in entries -%} + <li><a href="{{ url_for('blog_entry', slug=entry) }}">{{ entry }}</a></li> +{%- endfor %} +</ul> +{% endblock %}