hyde-hyde icon indicating copy to clipboard operation
hyde-hyde copied to clipboard

How to display the "publishDate" instead of the "date" in my pages?

Open AndyIbanez opened this issue 6 years ago • 1 comments

Hi.

Sorry if this is more of a Hugo issue instead of an issue with the theme. If I'm wrong posting this here, please point me to the right direction.

I just noticed that the published pages on my website are using the date of my articles instead of the publishDate.

---
title: "Understanding Property Wrappers in Swift"
date: 2019-11-23T16:26:13-04:00
draft: false
publishDate: 2019-11-27T07:00:00-04:00
highlightjslanguages:
 - swift
 - objectivec
tags:
 - swift
 - programming
 - apple
 - property wrappers
categories:
 - development
description: "Learn and understand what Property Wrappers are in Swift and how to use them."
keywords:
 - swift
 - programming
 - apple
 - property wrappers
---

That page is this one which, as you can see, says it was posted on November 23 Date instead of November 27 (publishDate)

I know that the workaround is as easy as replacing date with what I wrote in publishDate, but I want my markdown files to keep the original time in which a file was created. Is there any way I can make my websites show the publishDate by default, and only show the date when no publishDate is found?

I keep a weekly blog and I publish new articles every Wednesday, so I want the dates to reflect that. More often than not I start writing my articles well in advance so I just need to deploy the website when Wednesday comes around.

AndyIbanez avatar Nov 27 '19 23:11 AndyIbanez

@AndyIbanez That would need a bit of knowledge of Hugo/Go template and change the template accordingly.

htr3n avatar Jan 23 '21 02:01 htr3n