article.html 4.5 KB

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