article.html 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. {% extends "base.html" %}
  2. {% block title %}
  3. {{ article.title }} - {{ 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. <aside>
  36. {% for an_article in dates %}
  37. {% if an_article.url == article.url %}
  38. {% set index = loop.index0 %}
  39. {% if not loop.first %}
  40. {% set next_article = dates[index-1] %}
  41. {% endif %}
  42. {% if not loop.last %}
  43. {% set previous_article = dates[index+1] %}
  44. {% endif %}
  45. <nav>
  46. <ul class="articles_timeline">
  47. {% if previous_article %}
  48. {% set ptitle = previous_article.title %}
  49. {% set pv_title = ptitle %}
  50. {%if previous_article.subtitle %}
  51. {% set pv_title = ptitle + " " + "<small>" + previous_article.subtitle + "</small>" %}
  52. {% set ptitle = ptitle + " - " + previous_article.subtitle %}
  53. {% endif %}
  54. <li class="previous_article">« <a href="{{ SITEURL }}/{{ previous_article.url }}" title="Previous: {{ ptitle }}">{{ pv_title }}</a></li>
  55. {% endif %}
  56. {% if next_article %}
  57. {% set ntitle = next_article.title %}
  58. {% set nv_title = ntitle %}
  59. {%if next_article.subtitle %}
  60. {% set nv_title = ntitle + " " + "<small>" + next_article.subtitle + "</small>" %}
  61. {% set ntitle = ntitle + " - " + next_article.subtitle %}
  62. {% endif %}
  63. <li class="next_article"><a href="{{ SITEURL }}/{{ next_article.url }}" title="Next: {{ ntitle }}">{{ nv_title }}</a> »</li>
  64. {% endif %}
  65. </ul>
  66. </nav>
  67. {% endif %}
  68. {% endfor %}
  69. </aside>
  70. {% include 'comments.html' %}
  71. </div>
  72. <section>
  73. <div class="span2" style="float:right;font-size:0.9em;">
  74. {% if article.date %}
  75. <h4>Published</h4>
  76. {% set day = article.date.strftime('%d')|int %}
  77. <time pubdate="pubdate" datetime="{{ article.date.isoformat() }}">{{ article.date.strftime('%b') }} {{ day }} {{- article.date.strftime(', %Y') }}</time>
  78. {% endif %}
  79. {% if article.modified %}
  80. <h4>Last Updated</h4>
  81. <div class="last_updated">{{ article.modified }}</div>
  82. {% endif %}
  83. {% if article.category %}
  84. <h4>Category</h4>
  85. <a class="category-link" href="/categories.html#{{ category|replace(' ', '-')|e }}-ref">{{ article.category }}</a>
  86. {% endif %}
  87. {% if article.tags %}
  88. <h4>Tags</h4>
  89. <ul class="list-of-tags tags-in-article">
  90. {% for tag in article.tags|sort %}
  91. <li><a href="/tags.html#{{ tag|replace(' ', '-')|e }}-ref">{{ tag }}
  92. {% for aTag, tagged_articles in tags if aTag == tag %}
  93. <span>{{ tagged_articles|count }}</span>
  94. {% endfor %}</a></li>
  95. {% endfor %}
  96. </ul>
  97. {% endif %}
  98. {% if MAILCHIMP_FORM_ACTION %}
  99. {% if not EMAIL_SUBSCRIPTION_LABEL %}
  100. {% set EMAIL_SUBSCRIPTION_LABEL='Email Newsletter' %}
  101. {% endif %}
  102. {% if not SUBSCRIBE_BUTTON_TITLE %}
  103. {% set SUBSCRIBE_BUTTON_TITLE='Subscribe' %}
  104. {% endif %}
  105. {% if not EMAIL_PLACEHOLDER %}
  106. {% set EMAIL_PLACEHOLDER ='email address' %}
  107. {% endif %}
  108. <!-- Begin MailChimp Signup Form -->
  109. <div id="mc_embed_signup">
  110. <form action="{{ MAILCHIMP_FORM_ACTION }}" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
  111. <h4>{{ EMAIL_SUBSCRIPTION_LABEL }}</h4>
  112. <input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="{{ EMAIL_FIELD_PLACEHOLDER }}" required>
  113. <div class="clear"><input type="submit" value="{{ SUBSCRIBE_BUTTON_TITLE }}" name="subscribe" id="mc-embedded-subscribe" class="button"></div>
  114. </form>
  115. </div>
  116. <!--End mc_embed_signup-->
  117. {% endif %}
  118. </div>
  119. </section>
  120. </div>
  121. </article>
  122. {% endblock content %}
  123. {% block script %}
  124. {{ super() }}
  125. {% include 'disqus_script_count.html' %}
  126. {% if DISQUS_SITENAME and SITEURL and article.status != "draft" %}
  127. <script language="javascript" type="text/javascript">
  128. function uncollapse() {
  129. var hash_str = window.location.hash;
  130. if (window.location.hash.match(/^#comment-\d+$/))
  131. {
  132. var hash_str = '#disqus_thread';
  133. }
  134. $(hash_str).collapse({
  135. toggle: true
  136. })
  137. }
  138. </script>
  139. <script type="text/javascript" language="JavaScript">
  140. uncollapse();
  141. </script>
  142. {% endif %}
  143. {% endblock script %}