article.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. {{ article.content }}
  35. {% from 'comments.html' import comments with context %}
  36. {{ comments(article) }}
  37. <aside>
  38. <hr/>
  39. {% for an_article in dates %}
  40. {% if an_article.url == article.url %}
  41. {% set index = loop.index0 %}
  42. {% if not loop.first %}
  43. {% set next_article = dates[index-1] %}
  44. {% endif %}
  45. {% if not loop.last %}
  46. {% set previous_article = dates[index+1] %}
  47. {% endif %}
  48. <nav>
  49. <ul class="articles-timeline">
  50. {% if previous_article %}
  51. {% set ptitle = previous_article.title|striptags %}
  52. {% set pv_title = ptitle %}
  53. {%if previous_article.subtitle %}
  54. {% set pv_title = ptitle + ' ' + '<small>' + previous_article.subtitle + '</small>' %}
  55. {% set ptitle = ptitle + ' - ' + previous_article.subtitle %}
  56. {% endif %}
  57. <li class="previous-article">« <a href="{{ SITEURL }}/{{ previous_article.url }}" title="Previous: {{ ptitle }}">{{ pv_title }}</a></li>
  58. {% endif %}
  59. {% if next_article %}
  60. {% set ntitle = next_article.title|striptags %}
  61. {% set nv_title = ntitle %}
  62. {%if next_article.subtitle %}
  63. {% set nv_title = ntitle + ' ' + '<small>' + next_article.subtitle + '</small>' %}
  64. {% set ntitle = ntitle + ' - ' + next_article.subtitle %}
  65. {% endif %}
  66. <li class="next-article"><a href="{{ SITEURL }}/{{ next_article.url }}" title="Next: {{ ntitle }}">{{ nv_title }}</a> »</li>
  67. {% endif %}
  68. </ul>
  69. </nav>
  70. {% endif %}
  71. {% endfor %}
  72. </aside>
  73. </div>
  74. <section>
  75. <div class="span2" style="float:right;font-size:0.9em;">
  76. {% if article.date %}
  77. <h4>Published</h4>
  78. {% set day = article.date.strftime('%d')|int %}
  79. <time pubdate="pubdate" datetime="{{ article.date.isoformat() }}">{{ article.date.strftime('%b') }} {{ day }} {{- article.date.strftime(', %Y') }}</time>
  80. {% endif %}
  81. {% include 'last_updated.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 'social_links.html' %}
  98. {% include 'mailchimp.html' %}
  99. </div>
  100. </section>
  101. </div>
  102. </article>
  103. {% endblock content %}
  104. {% block script %}
  105. {{ super() }}
  106. {% include 'disqus_script_count.html' %}
  107. {% include 'disqus_comments_uncollapse.html' %}
  108. {% endblock script %}