article.html 4.7 KB

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