Closed diggeddy closed 19 hours ago
The Modified Date
should fallback to the published date if it hasn't been modified. So if someone wants to output the modified date ever, they should go with that tag. Otherwise, the published date will only ever show the date it was published.
Is that not what's happening on your end?
It is working as you describe. Bit of a misunderstanding on my part. I expected there to be an option to fallback as per 1.0.
However, the Required to render
should provide the option when a user want to remove the date. But this option doesn't work for this tag.
This looks like a bug and updated issue to reflect that.
I think to do that we would need to short-circuit the function if the modified date equals the published date and not return anything.
@tomusborne I don't believe this is a bug. The modified_date
refers to the post's modified date, and it retrieves data from the post_modified
column in the database. The post_modified
value always exists for a post because it is set when the post is created. Therefore, there is no scenario where a post has a null post_modified value. In the database, the column type is DATETIME
and is defined as NOT NULL
, which means it cannot be an empty string either.
@rsm0128 Yea, although I think it should be possible for the user to output only the modified date (and not the published date) if it exists. For example:
Date published: xx / Date modified: xx
Working on a potential solution for this right now.
I think {{modified_date}}
should be replaced with {{published_date}}
in /src/blocks/query/templates.js
file.
https://github.com/tomusborne/generateblocks/blob/release/2.0.0/src/blocks/query/templates.js#L124
https://github.com/tomusborne/generateblocks/blob/release/2.0.0/src/blocks/query/templates.js#L172
https://github.com/tomusborne/generateblocks/blob/release/2.0.0/src/blocks/query/templates.js#L222
https://github.com/tomusborne/generateblocks/blob/release/2.0.0/src/blocks/query/templates.js#L286
Description
GB 1.0 Dynamic data has option to display Modified Date or fallback to the Published Date so only the latest date can be displayed.