Skip to content

Instantly share code, notes, and snippets.

@pigfly
Last active August 29, 2015 14:22
Show Gist options
  • Save pigfly/4a396d183fd1cc1e7451 to your computer and use it in GitHub Desktop.
Save pigfly/4a396d183fd1cc1e7451 to your computer and use it in GitHub Desktop.
Gist for my post "Fix date not get rendered after upgrade octopress"
<h5 class="date-time">{% include post/date.html %}<i class="icon-calendar"></i> {{ time }}</h5>
{% capture date %}{{ page.date }}{{ post.date }}{% endcapture %}
{% capture date_formatted %}{{ page.date_formatted }}{{ post.date_formatted }}{% endcapture %}
{% capture has_date %}{{ date | size }}{% endcapture %}
{% capture updated %}{{ page.updated }}{{ post.updated }}{% endcapture %}
{% capture updated_formatted %}{{ page.updated_formatted }}{{ post.updated_formatted }}{% endcapture %}
{% capture was_updated %}{{ updated | size }}{% endcapture %}
{% if has_date != '0' %}
{% capture time %}<time datetime="{{ date | datetime | date_to_xmlschema }}" {% if updated %}data-updated="true"{% endif %} itemprop="datePublished">{{ date_formatted }}</time>{% endcapture %}
{% endif %}
{% if was_updated != '0' %}
{% capture updated %}<time datetime="{{ updated | datetime | date_to_xmlschema }}" class="updated" itemprop="dateModified">Updated {{ updated_formatted }}</time>{% endcapture %}
{% else %}{% assign updated = false %}{% endif %}
1c1
< <h5 class="date-time">{% include post/date.html %}<i class="icon-calendar"></i> {{ time }}</h5>
---
> <div class="date">{% include post/date.html %}{{ time }}</div>
{% if page.date %}{% capture time %}{{ page.date_time_html }}{% endcapture %}{% endif %}
{% if post.date %}{% capture time %}{{ post.date_time_html }}{% endcapture %}{% endif %}
@@ -1,15 +1,5 @@
-{% capture date %}{{ page.date }}{{ post.date }}{% endcapture %}
-{% capture date_formatted %}{{ page.date_formatted }}{{ post.date_formatted }}{% endcapture %}
-{% capture has_date %}{{ date | size }}{% endcapture %}
+{% if page.date %}{% capture time %}{{ page.date_time_html }}{% endcapture %}{% endif %}
+{% if post.date %}{% capture time %}{{ post.date_time_html }}{% endcapture %}{% endif %}
-{% capture updated %}{{ page.updated }}{{ post.updated }}{% endcapture %}
-{% capture updated_formatted %}{{ page.updated_formatted }}{{ post.updated_formatted }}{% endcapture %}
-{% capture was_updated %}{{ updated | size }}{% endcapture %}
-
-{% if has_date != '0' %}
- {% capture time %}<time datetime="{{ date | datetime | date_to_xmlschema }}" pubdate{% if updated %} data-updated="true"{% endif %}>{{ date_formatted }}</time>{% endcapture %}
-{% endif %}
-
-{% if was_updated != '0' %}
- {% capture updated %}<time datetime="{{ updated | datetime | date_to_xmlschema }}" class="updated">Updated {{ updated_formatted }}</time>{% endcapture %}
-{% else %}{% assign updated = false %}{% endif %}
+{% if page.updated %}{% capture updated %}{{ page.date_time_updated_html }}{% endcapture %}{% endif %}
+{% if post.updated %}{% capture updated %}{{ post.date_time_updated_html }}{% endcapture %}{% endif %}
<time class='entry-date' datetime='2014-07-03T14:08:00+00:00'>
<span class='date'>
<span class='date-month'>Jul</span>
<span class='date-day'>3</span><span class='date-suffix'>rd</span>,
<span class='date-year'>2014</span>
</span>
<span class='time'>2:08 pm</span>
</time>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment