Is there a way to reliably retrieve any metadata field? It seems I am randomly running into issues when my field names (which are controlled externally) overlap with field names Hugo thinks are special. Fields like date, pubdate, sometimes title, kind and type. Originally my assumption was that .Date for example would be the parsed version of the date field and .Params.date would be the raw metadata, but it doesn’t seem to work like this for many fields. Pubdate seems to be the worst since it not only changes the value but also removes the original field so that .Params.pubdate is null and .Params.publishdate has a parsed version of the date which in my case is not a parsable date since it’s like “Aug 2000” or “2019 Q1” or “Jan-Feb 2002” which happen to be Journal publication dates. Is there a special use-case which requires .Params.Field cannot just be the raw values? Maybe a .RawParams object might work if so?
I am pretty sure, that you are mixing a lot of different things together. The only “true” Hugo date fields are those in the link below. That link also gives some hints on how those fields get filled and parsed.
IF you have datefields in your frontmatter, it COULD be a field that your theme developer added and that is not part of Hugo, that is especially the case if you can reach them only via
.Param.Datefieldname. Official frontmatter datefields are reachable via
.Datefieldname. This could be the reason for some fields “unsetting” others as you described.
And pubdate is definitely not a Hugo field
Now, add to this all, that you might have git-data enabled (second link) the irritation will grow.