morris icon indicating copy to clipboard operation
morris copied to clipboard

Added null-coalescing check for published date

Open dg01d opened this issue 7 years ago • 3 comments

This small adjustment checks that there is a published date set on the incoming webmention.

If published is null, then it is set to the same datestamp as wm-received.

This deals with errors created in Hugo where "published": null causes a failure to build.

dg01d avatar Jun 08 '18 16:06 dg01d

Thanks for this PR!

Sent a PR to match up the whitespace w/ the rest of the file (unexpanded tabs, soorrry).

I also wanted to chat a bit about this change because I thought about adding this the first time through but decided to leave it out.

My thinking at the time was that if the original is missing a 'published' property, that might be intentional. For example, a reference page or something else non-date-y. It felt somewhat misleading to use the wm-received date in place of a published date, since it could be any time, as a mention doesn't have to be sent by the original publisher.

In my current templates, I check whether published is set before using it, and just omit it if absent.

I may be worrying too much, so I'd love to hear your thoughts!

martymcguire avatar Jun 08 '18 19:06 martymcguire

Merged your AWFUL whitespace.

dg01d avatar Jun 08 '18 19:06 dg01d

Hey Marty,

I didn't see your comment until this morning.

I can understand why you chose this path; it does make sense that the published date is available only where that data has relevance. I guess my templating skills aren't as good as yours.

dg01d avatar Jun 09 '18 15:06 dg01d