{% extends "blog/base.html" %}

{% block title %}
  <title>loopvid blog sources list</title>
{% endblock %}

{% block page %}
  <div class="page">
    <div class="source_list">
      {% for source in sources %}
        {% if source['num_videos'] > 0 %}
          {# link to source page #}
          <a class="source_link" href="/blog/{{ source['shortlink'] | e }}">
            {{ source['text'] | e }}
          </a>
          {# external link #}
          {% if source['url'] %}
            <span class="small">
              <a class="external_link smaller" rel="noreferrer" href="{{ source['url'] | e }}">
                (external url)
              </a>
            </span>
          {% endif %}
          {# number of videos with this source #}
          <span class="small">
            ({{ source['num_videos'] }} {% if source['num_videos'] > 1 %}videos{% else %}video{% endif %})
          </span>
          <br />
        {% endif %}
      {% endfor %}
    {% if not sources %}
      <p class="no_videos_message">Sorry, but we couldn't find what you were looking for. :(</p>
    {% endif %}
    </div>
  </div>
{% endblock %}
