{% extends "til_base.html" %}
{% block title %}F: all TILs{% endblock %}
{% block body %}
all TILs
{% set topics_found = [] %}
{%- for topic_row in sql("SELECT DISTINCT topics FROM til", database="tils") -%}
{%- if topic_row.topics -%}
{%- for topic in topic_row.topics.split(',') -%}
{%- if topic.strip() -%}
{%- if topic.strip() not in topics_found -%}
{%- set _ = topics_found.append(topic.strip()) -%}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{%- endfor %}
{% for topic in topics_found|sort %}
{{ topic }}
{% for til in sql("SELECT * FROM til WHERE topics LIKE '%" + topic + "%' ORDER BY created_utc DESC", database="tils") %}