Force publish/override single content date

I generate a table of content on my site and I realized today that it’s not publishing pages where conferences are happening in the future because I use the Date parameter to say when the conference will be. Is there a way to have hugo force publish a page if it’s in the future even if I don’t specify -F for the server? I don’t want to publish all of the future articles but I do for this /cfp folder

My other option is to set the date to a day in the past (maybe my submission date) and create a new parameter for conference date. I tried that but ran into a couple problems:

  1. I sort the table based on the date field which would make them out of order depending on when I submit CFPs. If I add a date field for sorting I can’t put the actual conference dates.
  2. I couldn’t figure out how to format the new confDate parameter in the function to be a date. I tried {{ .Params.confDate | dateFormat "2006-01" }} but it gave the error. error calling dateFormat: unable to cast <nil> of type <nil> to Time Maybe I missed a page but I think I found/replaced them all

Anyone have other ideas to force publish specific content with a future date?

That’s the right way to handle this. You cannot selectively force publish something with a future date.

This error:

error calling dateFormat: unable to cast of type to Time

Occurs because one or more of the pages rendered by this template code does not have a confDate in front matter. You need to code defensively:

{{ with .Params.confDate }}
  {{ . | dateFormat "2006-01" }}
{{ end }}
1 Like