]> git.draconx.ca Git - homepage.git/commitdiff
Fix display of updated date.
authorNick Bowler <nbowler@draconx.ca>
Wed, 10 Apr 2024 01:10:54 +0000 (21:10 -0400)
committerNick Bowler <nbowler@draconx.ca>
Wed, 10 Apr 2024 01:12:32 +0000 (21:12 -0400)
Looks like the updated date was never actually written to the output, so
the template to display it never did anything.  Furthermore, let's not
bother displaying the updated date if it's the same as the publish date.

layouts/default.xml
layouts/default.xsl

index 11aeec1e955d0a273d856a37d8d45b67b03eb48f..2f78b3d8481e3805fddaead2dd771b1da5ff39e1 100644 (file)
@@ -64,6 +64,8 @@ end %>
 %>  <article>
 <%= attribute_to_time(@item[:published]).strftime \
 "    <published>%Y-%m-%d</published>\n" if @item[:published]
+%><%= attribute_to_time(@item[:updated]).strftime \
+"    <updated>%Y-%m-%d</updated>\n" if @item[:updated]
 %>  </article>
 <% end
 %>  <html xmlns="<%= Xmlns['xhtml'] %>" id="<%=
index 6bf809440ac0c07b8dd411158ac0551d994ede51..aa22e8f23460062220cba346f2b7468de96bf1ef 100644 (file)
     <xsl:text>Posted </xsl:text>
     <xsl:value-of select='/document/article/published' />
     <xsl:if test='/document/article/updated'>
-      <xsl:text>, last updated </xsl:text>
-      <xsl:value-of select='/document/article/updated' />
+      <xsl:if test='/document/article/updated != /document/article/published'>
+        <xsl:text>, last updated </xsl:text>
+        <xsl:value-of select='/document/article/updated' />
+      </xsl:if>
     </xsl:if>
   </p>
 </xsl:template>