-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use date instead of file mtime for updated date #3235
Conversation
Because this date is unreliable when cloning a repository from git matches the last clone instead of lat update This is particularly important when used in cunjunction with hexo-generator-feed
Hi @tomap. It seems like a good idea. Where does the |
My use case is in feed plugin where the update date of a post makes no sense in my case, where I would want them to not use the file dates, but instead use the date, when no update is set. https://github.com/hexojs/hexo-generator-feed/blob/master/atom.xml#L24 However, after giving it some thought, I think it is more an option of feed to introduce or a new post property, otherwise, it will create a change of behavior |
@tomap Should we ask hexo core team their thoughts and see if anyone wants to talk more about this? I cannot yet understand what depends on these dates but it seems like a good idea you had. |
Yes, we should, especially given the breaking change possibility |
IMHO, this will change the purpose of the updated date field. I know some plugins use this field to set the updated date for the posts. Why not we modify the hexo-generator-feed to handle the date correctly, instead of changing the hexo itself? |
Agreed. I'll do a PR there |
Hi, I thougth a bit more about it and it is important to have this change inside hexo.
2/ If I do it at hexo level (with an option, for backward compatibility)
So I'm reopening this PR, and will amend it soon to include the new option for backward compatility (backward compatible behavior if false or unset) |
Using file mtime as For example, my In my case, I believe it is a b better option to use |
I prefer not dropping Would |
@curbengh indeed, mentionning updated in my posts would solve the situation, but I don't want to have to mention them to fix the issue. |
These two seem to be conflicting:
shouldn't it be "...when front-matter provides no updated date"? |
I fixed that. Thank you |
Thanks. I'll test it in the meantime. |
"lib/plugins/processor/asset.js" only affects page, similar lines also need to be added to "post.js". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works fine in my local test.
Note to theme dev, If a theme currently display updated date, it needs to add another condition:
|
Or we could introduce an easier property that would leave the updated property empty in case it is not set in front matter? |
The condition I mentioned is for compatibility when
Edit: Just realized the above condition will not display post.updated if use_date_for_updated is enabled. My previous comment still works. |
I would prefer that option, so
|
Are you going to implement that option in this PR or later? Otherwise, this is good to go. |
I'm not going to change this PR. |
- pretty_urls.trailing_index: hexojs/hexo#3691 - external_link.enable: hexojs/hexo#3675 - meta_generator: hexojs/hexo#3653 - use_date_for_updated: hexojs/hexo#3235
- pretty_urls.trailing_index: hexojs/hexo#3691 - external_link.enable: hexojs/hexo#3675 - meta_generator: hexojs/hexo#3653 - use_date_for_updated: hexojs/hexo#3235
- pretty_urls.trailing_index: hexojs/hexo#3691 - external_link.enable: hexojs/hexo#3675 - meta_generator: hexojs/hexo#3653 - use_date_for_updated: hexojs/hexo#3235
- pretty_urls.trailing_index: hexojs/hexo#3691 - external_link.enable: hexojs/hexo#3675 - meta_generator: hexojs/hexo#3653 - use_date_for_updated: hexojs/hexo#3235
Because this date is unreliable when cloning a repository from git
matches the last clone instead of lat update
This is particularly important when used in cunjunction with hexo-generator-feed
Thank you for creating a pull request to contribute to Hexo code! Before you open the request please review the following guidelines and tips to help it be more easily integrated: