article.html 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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">
  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. {% if article.toc %}
  27. <div class="col-md-2 table-of-content">
  28. <nav>
  29. <h4>Contents</h4>
  30. {{ article.toc }}
  31. </nav>
  32. </div>
  33. <div class="col-md-8 el-article-content">
  34. {% else %}
  35. <div class="col-md-8 col-md-offset-2 el-article-content">
  36. {% endif %}
  37. {% import '_includes/translations.html' as translations with context %}
  38. {{ translations.translations_for(article) }}
  39. {{ article.content }}
  40. {% from '_includes/share_links.html' import share_links with context %}
  41. {{ share_links(article) }}
  42. {% from '_includes/comments.html' import comments with context %}
  43. {{ comments(article) }}
  44. <hr/>
  45. {% include '_includes/related_posts.html' with context %}
  46. {% if article.prev_article or article.next_article %}
  47. <aside>
  48. <nav>
  49. <ul class="articles-timeline">
  50. {% if article.prev_article %}
  51. {% set ptitle = article.prev_article.title|striptags|e %}
  52. {% set pv_title = article.prev_article.title|striptags %}
  53. {%if article.prev_article.subtitle %}
  54. {% set pv_title = pv_title + ' ' + '<small>' + article.prev_article.subtitle|striptags + '</small>' %}
  55. {% set ptitle = ptitle + ' - ' + article.prev_article.subtitle|e %}
  56. {% endif %}
  57. <li class="previous-article">« <a href="{{ SITEURL }}/{{ article.prev_article.url }}" title="Previous: {{ ptitle }}">{{ pv_title }}</a></li>
  58. {% endif %}
  59. {% if article.next_article %}
  60. {% set ntitle = article.next_article.title|striptags|e %}
  61. {% set nv_title = article.next_article.title|striptags %}
  62. {%if article.next_article.subtitle %}
  63. {% set nv_title = nv_title + ' ' + '<small>' + article.next_article.subtitle|striptags + '</small>' %}
  64. {% set ntitle = ntitle + ' - ' + article.next_article.subtitle|e %}
  65. {% endif %}
  66. <li class="next-article"><a href="{{ SITEURL }}/{{ article.next_article.url }}" title="Next: {{ ntitle }}">{{ nv_title }}</a> »</li>
  67. {% endif %}
  68. </ul>
  69. </nav>
  70. </aside>
  71. {% endif %}
  72. </div>
  73. <section>
  74. <div class="col-md-2" style="float:right;font-size:0.9em;">
  75. {% if article.date %}
  76. <h4>Published</h4>
  77. {% set day = article.date.strftime('%d')|int %}
  78. <time pubdate="pubdate" datetime="{{ article.date.isoformat() }}">{{ article.date.strftime('%b') }} {{ day }} {{- article.date.strftime(', %Y') }}</time>
  79. {% endif %}
  80. {% include '_includes/last_updated.html' %}
  81. {% include '_includes/multi_parts.html' %}
  82. {% if article.category|trim|count > 0 %}
  83. <h4>Category</h4>
  84. <a class="category-link" href="{{ SITEURL }}/categories.html#{{ category.slug }}-ref">{{ article.category }}</a>
  85. {% endif %}
  86. {% if article.tags and article.tags[0]|trim|count > 0 %}
  87. <h4>Tags</h4>
  88. <ul class="list-of-tags tags-in-article">
  89. {% for tag in article.tags|sort %}
  90. <li><a href="{{ SITEURL }}/tags.html#{{ tag.slug }}-ref">{{ tag }}
  91. {% for aTag, tagged_articles in tags if aTag == tag %}
  92. <span>{{ tagged_articles|count }}</span>
  93. {% endfor %}</a></li>
  94. {% endfor %}
  95. </ul>
  96. {% endif %}
  97. {% include '_includes/social_links.html' %}
  98. {% include '_includes/mailchimp.html' %}
  99. </div>
  100. </section>
  101. </div>
  102. </article>
  103. {% endblock content %}
  104. {% block script %}
  105. {{ super() }}
  106. {% from '_includes/comments.html' import comments_script with context %}
  107. {{ comments_script(article) }}
  108. {% endblock script %}