tags.html 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. {% extends 'base.html' %}
  2. {% block title %}
  3. All Tags · {{ super() }}
  4. {% endblock title %}
  5. {% block head_description %}
  6. All tags used in the {{ SITENAME|striptags|e }} blog.
  7. {% endblock head_description %}
  8. {% block meta_tags_in_head %}
  9. {{ super() }}
  10. <meta property="og:title" content="All Tags · {{ SITENAME|striptags|e }}"/>
  11. <meta name="twitter:title" content="All Tags · {{ SITENAME|striptags|e }}">
  12. <meta property="og:url" content="{{ SITEURL }}/tags.html" />
  13. <meta property="og:description" content="All tags used in the {{ SITENAME|striptags|e }} blog" />
  14. <meta name="twitter:description" content="All tags used in the {{ SITENAME|striptags|e }} blog">
  15. <meta property="og:site_name" content="{{ SITENAME|striptags|e }}" />
  16. <meta property="og:article:author" content="{{ AUTHOR }}" />
  17. {% from '_includes/_defaults.html' import FEATURED_IMAGE with context %}
  18. {% if FEATURED_IMAGE %}
  19. <meta property="og:image" content="{{FEATURED_IMAGE}}" />
  20. <meta name="twitter:image" content="{{FEATURED_IMAGE}}" >
  21. {% endif %}
  22. {% endblock meta_tags_in_head %}
  23. {% block feed_links %}
  24. {{ super() }}
  25. {% include '_includes/feeds_tags.html' %}
  26. {% endblock feed_links %}
  27. {% block content %}
  28. <div class="row">
  29. <header class="page-header col-md-10 col-md-offset-2">
  30. <h1><a href="{{ SITEURL }}/tags.html">All Tags</a></h1>
  31. </header>
  32. </div>
  33. <div class="row">
  34. <div class="col-md-8 col-md-offset-2">
  35. <form class="form-inline">
  36. <div class="form-group">
  37. <input type="text" class="form-control filterinput" placeholder="Find a tag">
  38. </div>
  39. </form>
  40. <ul class="list-of-tags">
  41. {% for tag, articles in tags|sort %}
  42. <li>
  43. {% set num = articles|count %}
  44. <a href="#{{ tag.slug }}-ref">{{ tag }}<span>{{ num }}</span></a>
  45. </li>
  46. {% endfor %}
  47. </ul>
  48. </div>
  49. </div>
  50. <div class="row">
  51. <div class="col-md-8 col-md-offset-2">
  52. {% for tag, articles in tags|sort %}
  53. <h2 id="{{ tag.slug }}-ref" class="list-of-tags">{{ tag }}</h2>
  54. <ul class="articles-in-tag">
  55. {% for article in articles|sort(reverse = true, attribute = 'date') %}
  56. <li><time pubdate="pubdate" datetime="{{ article.date.isoformat() }}">{{ article.locale_date }}</time><a href="{{ SITEURL }}/{{ article.url }}">{{ article.title }} {%if article.subtitle %} <small> {{ article.subtitle }} </small> {% endif %} </a></li>
  57. {% endfor %}
  58. </ul>
  59. {% endfor %}
  60. </div>
  61. </div>
  62. {% endblock content %}
  63. {% block script %}
  64. {{ super() }}
  65. <script>
  66. (function ($) {
  67. // custom css expression for a case-insensitive contains()
  68. jQuery.expr[':'].Contains = function(a,i,m){
  69. return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase())>=0;
  70. };
  71. function listFilter() {
  72. $('.filterinput')
  73. .change( function () {
  74. var filter = $(this).val();
  75. if(filter) {
  76. // this finds all links in a list that contain the input,
  77. // and hide the ones not containing the input while showing the ones that do
  78. $('.list-of-tags').find("a:not(:Contains(" + filter + "))").parent().hide();
  79. $('.list-of-tags').find("a:Contains(" + filter + ")").parent().show();
  80. } else {
  81. $('.list-of-tags').find("li").show();
  82. }
  83. return false;
  84. })
  85. .keyup( function () {
  86. // fire the above change event after every letter
  87. $(this).change();
  88. });
  89. }
  90. //ondomready
  91. $(function () {
  92. listFilter($());
  93. });
  94. }(jQuery));
  95. </script>
  96. {% endblock script %}