[Optimization] Rewrite some code logic and method change for post_meta.updated_at option.#228
Conversation
Original updated_diff checking method changed
From date(new Date(), [format])
To full_date(new Date(), [format])
For full datetime checking.
Also merge some excess if statement.
References theme-next#223
|
As from user point of view if just turn on # Post meta display settings
post_meta:
item_text: true
created_at: true
updated_at: true
categories: true
# Only show 'updated' if different from 'created'.
updated_diff: true
# If set this option, the updated_diff will check diff base on this format.
# Leave empty will check by both date and time.
updated_diff_check_format:
# Leave empty will use default hexo date_formt + ' ' + time_format for every post.
datetime_format:And see this:
I think user don't want to see time (07:02:31) if dates already have different (2017-09-20 vs 2017-10-03).
Also, i think need to make some refactors in this Instead of this: post_meta:
item_text: true
created_at: true
updated_at: false
# Only show 'updated' if different from 'created'.
updated_diff: false
# If set this option, the updated_diff will check diff base on this format.
# Leave empty will check by both date and time.
updated_diff_check_format:
# Leave empty will use default hexo date_formt + ' ' + time_format for every post.
datetime_format:
categories: trueDo this: post_meta:
item_text: true
created_at: true
updated_at:
enable: false
# Only show 'updated' if different from 'created'.
updated_diff: false
# If set this option, the updated_diff will check diff base on this format.
# Leave empty will check by both date and time.
updated_diff_check_format:
# Leave empty will use default hexo date_formt + ' ' + time_format for every post.
datetime_format:
categories: true |
|
Totally agree with the idea about ' keeping simple'. With time display style, here is some idea that comes out of my mind.
After all, the final _config.yml will look like: post_meta:
...
updated_at:
enable: false
# Only show 'updated' if different from 'created'.
updated_diff: false
# If set this option, the updated_diff will check diff base on this format.
# Leave empty will check by both date and time.
diff_check_format:
...or maybe it have other features needs more filed. |
|
1 and 2 what u are suggested is fine, yep. That's what i'm talking about in my 1st suggest.
But maybe it can be improved with something like:
? Or just like that:
OR! And this is best variant as for me:
Need to appear as little digits as possible on main pages. But if user want to see details, he can do it, right? post_meta:
...
updated_at:
enable: false
# Only show 'updated' if different from 'created'.
updated_diff: false
# If set this option, the updated_diff will check diff base on this format.
# Leave empty will check by both date and time.
diff_check_format:
...Yep! That's seems good for me. But i still don't understand |
|
popping bubble of full datetime format is a fascinated idea! and i just commited with it! Im think that why not just let created time also shows Today or not.
about _config.yml, i think the meaning of customize is not so important. post_meta:
item_text: true
created_at: true
updated_at:
enable: false
# Only show 'updated' if different from 'created'.
updated_diff: false
categories: trueor you think we should keep customize setting. |
I think u can make commits and we will see to the way of the road how to look's that. Anyway, this is important option and no need to do this fast. Release of 6.2.0 will in April 15, so, we have a lot of time to improve this feature. ADDED: if we will show full date / time in titles, no need to create «Today» translate i think. If post was changed today, in title we can show: And in meta we just keep maximum old / default style, like:
|
|
Oh, i have already committed, i added a under line at created and modified time for more user notice, |
|
Many digits. Need to keep simpler, see my previous comment. |
|
i haven't remove the very begin's commit content about later i will working on reducing digits. |
Yeah, need to keep maximum web space, i know. Keep it maximum simpler. |
|
Saw your ADDED, and quiet not understand with:
if same DAYS, output both date and time like this ? |
Yeah, just like that.
If same days, no need output «Modified». Only I think any post created can be modified many times in one day, for example. So, it is some stupid to show «Modified» every time on every post with |
|
i got you! show in title means HTML time tag's title attribute 🤣 DIFF DAYS => show both create / update time in post meat i'm also wondering every time i saved a .md that modified time will be change, |
|
Title = Bubble, yes! It also called popup.
It make Hexo, we can't do anything here with this. We only can display it or not. |
|
@ivan-nginx i have already make some changes on showing datetime, you can also find some preview on my site and here is something needs more opinion about:
|
|
Yeah, seem's good. |
| } | ||
|
|
||
| time { | ||
| border-bottom: 1px solid $grey-dark; |
There was a problem hiding this comment.
i was thinking MB a underline would helping user's to notice that there is more info about time.
not underline but MB something else would not confuse with href link.
There was a problem hiding this comment.
Yeah, need to think about it, but underline seems like it's hyperlink and really do some confuse. 😃
There was a problem hiding this comment.
MB we can replace solid to dotted?
There was a problem hiding this comment.
Or better dotted?
Try to play around with this: https://www.w3schools.com/cssref/pr_border-bottom_style.asp
1. Modified default settings: AWL = 4; WPM = 275. 2. Added suffix as string parameter if time to read less then 60 minutes. Default: 'mins.' 3. Refactored language translates.
|
@ivan-nginx i have already push the latest stuff about underline style and popup. |
|
Yeah! For now seem's pefect. I'll edit it a little. |
|
Alright, i test it and there is some bugs: if i turn off I suggest what with |
1. Replaced `updated_diff` by `only_diff` and set it under suboption: `updated_at.only_diff`.
1. If true, show updated date label only if `updated date` different from 'created date' (post edited in another day than was created). And if post will edited in same day as created, edited time will show in popup title under created time label. 2. If false show anyway, but if post edited in same day, show only edited time.
|
post_meta.updated_at option.
| edited: Edited on | ||
| created: Created | ||
| modified: Modified | ||
| edit: Edit this post |
There was a problem hiding this comment.
I recommend for its display like Creation time: 2018-4-16 18:25:03 in popup annotation.
+ created: Creation time
+ modified: Modification timeThere was a problem hiding this comment.
I think no need long labels here. When user move mouse under the date, he understand what he see date/time of post creation/modification.
So, Created: 2018-04-14 12:51:10 / Modified: 23:00:00 — look's fine i think.
|
one thing seems strange. it was updated in 2018-5-12, but today it's 2018-5-16, but shows time only today. no, but it's static... hexo-theme-next/layout/_macro/post.swig Line 77 in cc07c43 |
[Optimization] Rewrite some code logic and method change for `post_meta.updated_at` option.



Accidentally close previous PR, sorry..
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
With NexT _config.yml setting:
In every post
ex create time is 2018-01-01 08:00:00 edite time is 2018-01-01 10:00:00
But with this _config.yml setting:
updated_diff would not check by date and time but only date.
What is the new behavior?
By changing check statement from date to datetime.
_config.yml no longer need date_time_merge field, default will be check by also date and time.
with default new filed in _config.yml setting:
How to use?
The default setting is empty, so the check and render all using full format.
And this may effect some users who want to only resent YYYY-MM-DD
By setting datetime_format to YYYY-MM-DD than everything won't be effect but only checking format.
and yes, it works!
Does this PR introduce a breaking change?