tags.twig 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. {% extends "index.twig" %}
  2. {% block content %}
  3. {% set tstring = url_param('q','string') %}
  4. {% set length = tag_count[tstring] %}
  5. {% if length == 1 %}
  6. <h4>1 post is tagged "{{tstring}}"</h4>
  7. {% else %}
  8. <h4>{{ length }} posts are tagged "{{tstring}}"</h4>
  9. {% endif %}
  10. {% if config.tagblog.paging > 0 and length > config.tagblog.paging %}
  11. {% set p = url_param('p','int',1) %}
  12. {% set offset = (p - 1) * config.tagblog.paging %}
  13. {% set lastpage = length//config.tagblog.paging %}
  14. {% if length%config.tagblog.paging > 0 %}{% set lastpage = lastpage + 1 %}{% endif %}
  15. {% for page_id in tag_pages[tstring]|slice(1)|split('#')|slice(offset,config.tagblog.paging) %}
  16. {% set page = pages[page_id] %}
  17. {% include 'includes/postlistitem.twig' %}
  18. {% endfor %}
  19. <div class="pagination clearfix">
  20. {% if offset >= config.tagblog.paging %}
  21. <div class="previous"><a href="/tags?q={{tstring}}&p={{ p - 1 }}">&lt;Previous Page</a></div>
  22. {% endif %}
  23. {# {% if offset >= config.tagblog.paging and offset + config.tagblog.paging < length %} | {% endif %} #}
  24. <div class="current">- {{ p }}/{{ lastpage }} -</div>
  25. {% if offset + config.tagblog.paging < length %}
  26. <div class="next"><a href="/tags?q={{tstring}}&p={{ p + 1 }}">Next Page&gt;</a></div>
  27. {% endif %}
  28. </div>
  29. {% else %}
  30. {% for page_id in tag_pages[tstring]|slice(1)|split('#') %}
  31. {% set page = pages[page_id] %}
  32. {% include 'includes/postlistitem.twig' %}
  33. {% endfor %}
  34. {% endif %}
  35. {% endblock content %}