@@ -48,6 +48,8 @@ posts_overview: | |||
# Customize the archive view. | |||
# Options: | |||
# - sort_updated: sort posts by last modification date instead of creation date. | |||
# Note: this does not work together with pagination, since the pagination | |||
# plugin will sort pages by date of creation. | |||
archive: | |||
sort_updated: false | |||
@@ -6,7 +6,7 @@ | |||
(Updated: <time datetime="<%= date_xml(post.updated) %>" itemprop="dateModified"><%= date(post.updated, config.date_format) %></time>) | |||
<% } %> | |||
<% } else { %> | |||
<% if (theme.posts_overview.sort_updated) { %> | |||
<% if (is_home() && theme.posts_overview.sort_updated || is_archive() && theme.archive.sort_updated ) { %> | |||
<time datetime="<%= date_xml(post.updated) %>" itemprop="dateModified"><%= date(post.updated, config.date_format) %></time> | |||
<% } else { %> | |||
<time datetime="<%= date_xml(post.date) %>" itemprop="datePublished"><%= date(post.date, config.date_format) %></time> |
@@ -4,7 +4,7 @@ | |||
<% var change = false %> | |||
<% var field_sort = theme.archive.sort_updated ? 'updated' : 'date' %> | |||
<% page.posts.sort(field_sort, 'desc').each(function(post) { %> | |||
<% var itemYear = date(post.date, 'YYYY') - 0 %> | |||
<% var itemYear = date(post[field_sort], 'YYYY') - 0 %> | |||
<% change = year !== itemYear %> | |||
<% year = change ? itemYear : year %> | |||
<% if (change) { %> |