article.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. {% extends 'base.html' %}
  2. {% block title %}
  3. {{ article.title|striptags|e }} {%if article.subtitle %} - {{ article.subtitle|striptags|e }} {% endif %} · {{ super() }}
  4. {% endblock title %}
  5. {% block head_description %}
  6. {% if article.summary %}
  7. {{ article.summary|striptags|e }}
  8. {% endif %}
  9. {% endblock head_description %}
  10. {% block meta_tags_in_head %}
  11. {{ super() }}
  12. {% if article.tags or article.category or article.keywords %}
  13. <meta name="keywords" content="{{ [article.tags|join(', '), article.category, article.keywords]|join(', ') }}" />
  14. {% endif %}
  15. {% from '_includes/smo_metadata.html' import smo_metadata with context %}
  16. {{ smo_metadata(article) }}
  17. {% endblock meta_tags_in_head %}
  18. {% block content %}
  19. <article>
  20. <div class="row">
  21. <header class="page-header col-md-10 col-md-offset-2 col-lg-offset-1 col-lg-11">
  22. <h1><a href="{{ SITEURL }}/{{ article.url }}"> {{ article.title }} {%if article.subtitle %} <small> {{ article.subtitle }} </small> {% endif %} </a></h1>
  23. </header>
  24. </div>
  25. <div class="row">
  26. <div class="col-md-8 col-md-offset-2 col-lg-10 col-lg-offset-1 article-content">
  27. {% import '_includes/translations.html' as translations with context %}
  28. {{ translations.translations_for(article) }}
  29. {{ article.content }}
  30. {% from '_includes/share_links.html' import share_links with context %}
  31. {{ share_links(article) }}
  32. {% from '_includes/comments.html' import comments with context %}
  33. {{ comments(article) }}
  34. <hr/>
  35. {% include '_includes/related_posts.html' with context %}
  36. {% if article.prev_article or article.next_article %}
  37. <aside>
  38. <nav>
  39. <ul class="articles-timeline">
  40. {% if article.prev_article %}
  41. {% set ptitle = article.prev_article.title|striptags|e %}
  42. {% set pv_title = article.prev_article.title|striptags %}
  43. {%if article.prev_article.subtitle %}
  44. {% set pv_title = pv_title + ' ' + '<small>' + article.prev_article.subtitle|striptags + '</small>' %}
  45. {% set ptitle = ptitle + ' - ' + article.prev_article.subtitle|e %}
  46. {% endif %}
  47. <li class="previous-article">« <a href="{{ SITEURL }}/{{ article.prev_article.url }}" title="Previous: {{ ptitle }}">{{ pv_title }}</a></li>
  48. {% endif %}
  49. {% if article.next_article %}
  50. {% set ntitle = article.next_article.title|striptags|e %}
  51. {% set nv_title = article.next_article.title|striptags %}
  52. {%if article.next_article.subtitle %}
  53. {% set nv_title = nv_title + ' ' + '<small>' + article.next_article.subtitle|striptags + '</small>' %}
  54. {% set ntitle = ntitle + ' - ' + article.next_article.subtitle|e %}
  55. {% endif %}
  56. <li class="next-article"><a href="{{ SITEURL }}/{{ article.next_article.url }}" title="Next: {{ ntitle }}">{{ nv_title }}</a> »</li>
  57. {% endif %}
  58. </ul>
  59. </nav>
  60. </aside>
  61. {% endif %}
  62. </div>
  63. <section>
  64. <div class="col-md-2" style="float:right;font-size:0.9em;">
  65. <hr class="hidden-lg hidden-md" />
  66. {% if article.date %}
  67. <h4>Published</h4>
  68. {% set day = article.date.strftime('%d')|int %}
  69. <time pubdate="pubdate" datetime="{{ article.date.isoformat() }}">{{ article.date.strftime('%b') }} {{ day }} {{- article.date.strftime(', %Y') }}</time>
  70. {% endif %}
  71. {% include '_includes/last_updated.html' %}
  72. {% include '_includes/multi_parts.html' %}
  73. {% if article.category|trim|count > 0 %}
  74. <h4>Category</h4>
  75. <a class="category-link" href="{{ SITEURL }}/categories.html#{{ category.slug }}-ref">{{ article.category }}</a>
  76. {% endif %}
  77. {% if article.tags and article.tags[0]|trim|count > 0 %}
  78. <h4>Tags</h4>
  79. <ul class="list-of-tags tags-in-article">
  80. {% for tag in article.tags|sort %}
  81. <li><a href="{{ SITEURL }}/tags.html#{{ tag.slug }}-ref">{{ tag }}
  82. {% for aTag, tagged_articles in tags if aTag == tag %}
  83. <span>{{ tagged_articles|count }}</span>
  84. {% endfor %}</a></li>
  85. {% endfor %}
  86. </ul>
  87. {% endif %}
  88. {% include '_includes/social_links.html' %}
  89. {% include '_includes/mailchimp.html' %}
  90. </div>
  91. </section>
  92. </div>
  93. </article>
  94. {% endblock content %}
  95. {% block script %}
  96. {{ super() }}
  97. {% from '_includes/comments.html' import comments_script with context %}
  98. {{ comments_script(article) }}
  99. {% endblock script %}