File tree 2 files changed +12
-3
lines changed
2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -3,9 +3,10 @@ const home_category_limit_number = 3
3
3
const home_tag_limit_number = 5
4
4
5
5
const show_home_post_block_datetime = theme .home .hasOwnProperty (' post_datetime' ) ? !! theme .home .post_datetime : true
6
- const post_datetime_value = (theme .home .hasOwnProperty (' post_datetime' ) ? theme .home ? .post_datetime : ' updated' ) || ' updated'
6
+ const home_post_datetime_value = (theme .home .hasOwnProperty (' post_datetime' ) ? theme .home ? .post_datetime : ' updated' ) || ' updated'
7
+ const home_post_datetime_format = (theme .home .hasOwnProperty (' post_datetime_format' ) ? theme .home ? .post_datetime_format : ' ago' ) || ' ago'
7
8
8
- const post_datetime_split_list = post_datetime_value ? .split (' ||' )
9
+ const post_datetime_split_list = home_post_datetime_value ? .split (' ||' )
9
10
const post_datetime_type = post_datetime_split_list[0 ]? .trim ()? .toLowerCase ()
10
11
const post_datetime_icon = post_datetime_split_list[1 ]? .trim ()? .toLowerCase ()
11
12
@@ -20,7 +21,9 @@ const home_post_block_datetime = post_datetime_type === 'created' ? post.date :
20
21
< div class = " post-meta-info border-box" >
21
22
< % if (page_type === ' home' && show_home_post_block_datetime) { % >
22
23
< span class = " meta-info-item border-box" >
23
- < i class = " icon <%= home_post_block_datetime_icon %>" >< / i> & nbsp;< span class = " home-post-history" data- updated= " <%= home_post_block_datetime %>" >< %= date (home_post_block_datetime, ' YYYY-MM-DD HH:mm:ss' ) % >< / span>
24
+ < i class = " icon <%= home_post_block_datetime_icon %>" >< / i> & nbsp;< span class = " home-post-history"
25
+ data- updated= " <%= home_post_block_datetime %>"
26
+ >< %= date (home_post_block_datetime, home_post_datetime_format === ' ago' ? ' YYYY-MM-DD HH:mm:ss' : home_post_datetime_format) % >< / span>
24
27
< / span>
25
28
< % } % >
26
29
Original file line number Diff line number Diff line change @@ -332,6 +332,12 @@ KEEP.initUtils = () => {
332
332
333
333
// set how long age in home post block
334
334
setHowLongAgoInHome ( ) {
335
+ const { post_datetime_format } = KEEP . theme_config ?. home || { }
336
+
337
+ if ( post_datetime_format && post_datetime_format !== 'ago' ) {
338
+ return
339
+ }
340
+
335
341
const post = document . querySelectorAll ( '.post-meta-info .home-post-history' )
336
342
post &&
337
343
post . forEach ( ( v ) => {
You can’t perform that action at this time.
0 commit comments