Skip to content
Permalink
Browse files
Add (optional) fancydate support and support for update time to base …
…templates.
  • Loading branch information
George Leslie-Waksman committed Aug 9, 2018
1 parent 1220595 commit 439166302548826ef23a5353174650150174602b
@@ -20,6 +20,14 @@
{{ footer.html_footer() }}
</div>
{{ base.late_load_js() }}
{% if date_fanciness != 0 %}
<!-- fancy dates -->
<script>
moment.locale("{{ momentjs_locales[lang] }}");
fancydates({{ date_fanciness }}, {{ js_date_format }});
</script>
<!-- end fancy dates -->
{% endif %}
{% block extra_js %}{% endblock %}
<script>
baguetteBox.run('div#content', {
@@ -66,14 +66,27 @@ lang="{{ lang }}">
{% if use_bundles %}
{% if use_cdn %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.9.1/baguetteBox.min.js" integrity="sha256-SoEATAB7PgNWyyK100I7yQXYm5V08k5SFupDP0h72MY=" crossorigin="anonymous"></script>
{% if date_fanciness != 0 %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.1/moment-with-locales.min.js"></script>
{% endif %}
<script src="/assets/js/all.js"></script>
{% else %}
<script src="/assets/js/all-nocdn.js"></script>
{% endif %}
{% else %}
{% if use_cdn %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.9.1/baguetteBox.min.js" integrity="sha256-SoEATAB7PgNWyyK100I7yQXYm5V08k5SFupDP0h72MY=" crossorigin="anonymous"></script>
{% if date_fanciness != 0 %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.1/moment-with-locales.min.js"></script>
{% endif %}
{% else %}
<script src="/assets/js/baguetteBox.min.js"></script>
{% if date_fanciness != 0 %}
<script src="/assets/js/moment-with-locales.min.js"></script>
{% endif %}
{% endif %}
{% if date_fanciness != 0 %}
<script src="/assets/js/fancydates.js"></script>
{% endif %}
{% endif %}
{{ social_buttons_code }}
@@ -37,7 +37,15 @@
{{ post.author()|e }}
{% endif %}
</span></p>
<p class="dateline"><a href="{{ post.permalink() }}" rel="bookmark"><time class="published dt-published" datetime="{{ post.formatted_date('webiso') }}" title="{{ post.formatted_date(date_format)|e }}">{{ post.formatted_date(date_format)|e }}</time></a></p>
<p class="dateline">
<a href="{{ post.permalink() }}" rel="bookmark">
<time class="published dt-published" datetime="{{ post.formatted_date('webiso') }}" itemprop="datePublished" title="{{ post.formatted_date(date_format)|e }}">{{ post.formatted_date(date_format)|e }}</time>
{% if post.updated and post.updated != post.date %}
<span class="updated"> updated </span>
<time class="updated dt-updated" datetime="{{ post.formatted_updated('webiso') }}" itemprop="dateUpdated" title="{{ post.formatted_updated(date_format)|e }}">{{ post.formatted_updated(date_format)|e }}</time>
{% endif %}
</a>
</p>
{% if not post.meta('nocomments') and site_has_comments %}
<p class="commentline">{{ comments.comment_link(post.permalink(), post._base_path) }}
{% endif %}
@@ -38,7 +38,15 @@
{{ post.author()|e }}
{% endif %}
</span></p>
<p class="dateline"><a href="{{ post.permalink() }}" rel="bookmark"><time class="published dt-published" datetime="{{ post.formatted_date('webiso') }}" itemprop="datePublished" title="{{ post.formatted_date(date_format)|e }}">{{ post.formatted_date(date_format)|e }}</time></a></p>
<p class="dateline">
<a href="{{ post.permalink() }}" rel="bookmark">
<time class="published dt-published" datetime="{{ post.formatted_date('webiso') }}" itemprop="datePublished" title="{{ post.formatted_date(date_format)|e }}">{{ post.formatted_date(date_format)|e }}</time>
{% if post.updated and post.updated != post.date %}
<span class="updated"> updated </span>
<time class="updated dt-updated" datetime="{{ post.formatted_updated('webiso') }}" itemprop="dateUpdated" title="{{ post.formatted_updated(date_format)|e }}">{{ post.formatted_updated(date_format)|e }}</time>
{% endif %}
</a>
</p>
{% if not post.meta('nocomments') and site_has_comments %}
<p class="commentline">{{ comments.comment_link(post.permalink(), post._base_path) }}
{% endif %}
@@ -3,7 +3,7 @@ function fancydates(fanciness, date_format) {
return;
}

var dates = document.getElementsByClassName('dt-published');
var dates = document.querySelectorAll('.dt-published, .dt-updated');

var l = dates.length;

Some generated files are not rendered by default. Learn more.

@@ -1,3 +1,4 @@
assets/css/all.css=rst_base.css,nikola_rst.css,code.css,theme.css
assets/css/all-nocdn.css=rst_base.css,nikola_rst.css,code.css,theme.css,baguetteBox.min.css
assets/css/all-nocdn.js=baguetteBox.min.js
assets/js/all.js=fancydates.js
assets/js/all-nocdn.js=baguetteBox.min.js,moment-with-locales.min.js,fancydates.js
@@ -20,6 +20,14 @@ ${template_hooks['extra_head']()}
${footer.html_footer()}
</div>
${base.late_load_js()}
% if date_fanciness != 0:
<!-- fancy dates -->
<script>
moment.locale("${momentjs_locales[lang]}");
fancydates(${date_fanciness}, ${js_date_format});
</script>
<!-- end fancy dates -->
% endif
<%block name="extra_js"></%block>
<script>
baguetteBox.run('div#content', {
@@ -66,14 +66,27 @@ lang="${lang}">
% if use_bundles:
% if use_cdn:
<script src="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.9.1/baguetteBox.min.js" integrity="sha256-SoEATAB7PgNWyyK100I7yQXYm5V08k5SFupDP0h72MY=" crossorigin="anonymous"></script>
% if date_fanciness != 0:
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.1/moment-with-locales.min.js"></script>
% endif
<script src="/assets/js/all.js"></script>
% else:
<script src="/assets/js/all-nocdn.js"></script>
% endif
% else:
% if use_cdn:
<script src="https://cdnjs.cloudflare.com/ajax/libs/baguettebox.js/1.9.1/baguetteBox.min.js" integrity="sha256-SoEATAB7PgNWyyK100I7yQXYm5V08k5SFupDP0h72MY=" crossorigin="anonymous"></script>
% if date_fanciness != 0:
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.1/moment-with-locales.min.js"></script>
% endif
% else:
<script src="/assets/js/baguetteBox.min.js"></script>
% if date_fanciness != 0:
<script src="/assets/js/moment-with-locales.min.js"></script>
% endif
% endif
% if date_fanciness != 0:
<script src="/assets/js/fancydates.js"></script>
% endif
% endif
${social_buttons_code}
@@ -37,7 +37,15 @@
${post.author()|h}
% endif
</span></p>
<p class="dateline"><a href="${post.permalink()}" rel="bookmark"><time class="published dt-published" datetime="${post.formatted_date('webiso')}" title="${post.formatted_date(date_format)|h}">${post.formatted_date(date_format)|h}</time></a></p>
<p class="dateline">
<a href="${post.permalink()}" rel="bookmark">
<time class="published dt-published" datetime="${post.formatted_date('webiso')}" itemprop="datePublished" title="${post.formatted_date(date_format)|h}">${post.formatted_date(date_format)|h}</time>
% if post.updated and post.updated != post.date:
<span class="updated"> updated </span>
<time class="updated dt-updated" datetime="${post.formatted_updated('webiso')}" itemprop="dateUpdated" title="${post.formatted_updated(date_format)|h}">${post.formatted_updated(date_format)|h}</time>
% endif
</a>
</p>
% if not post.meta('nocomments') and site_has_comments:
<p class="commentline">${comments.comment_link(post.permalink(), post._base_path)}
% endif
@@ -38,7 +38,15 @@
${post.author()|h}
% endif
</span></p>
<p class="dateline"><a href="${post.permalink()}" rel="bookmark"><time class="published dt-published" datetime="${post.formatted_date('webiso')}" itemprop="datePublished" title="${post.formatted_date(date_format)|h}">${post.formatted_date(date_format)|h}</time></a></p>
<p class="dateline">
<a href="${post.permalink()}" rel="bookmark">
<time class="published dt-published" datetime="${post.formatted_date('webiso')}" itemprop="datePublished" title="${post.formatted_date(date_format)|h}">${post.formatted_date(date_format)|h}</time>
% if post.updated and post.updated != post.date:
<span class="updated"> updated </span>
<time class="updated dt-updated" datetime="${post.formatted_updated('webiso')}" itemprop="dateUpdated" title="${post.formatted_updated(date_format)|h}">${post.formatted_updated(date_format)|h}</time>
% endif
</a>
</p>
% if not post.meta('nocomments') and site_has_comments:
<p class="commentline">${comments.comment_link(post.permalink(), post._base_path)}
% endif

0 comments on commit 4391663

Please sign in to comment.