Skip to content

Commit fc9a1de

Browse files
committed
feat: support custom set datetime icon in home post block (#300)
1 parent 5762a9c commit fc9a1de

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

layout/_partial/post/post-meta-info.ejs

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
<%
22
const home_category_limit_number = 3
33
const home_tag_limit_number = 5
4-
const home_post_block_datetime = theme.home?.post_datetime === 'created' ? post.date : post.updated
5-
const home_post_block_datetime_icon = theme.home?.post_datetime === 'created' ? 'fa-solid fa-file-circle-plus' : 'fa-solid fa-history'
4+
65
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'
7+
8+
const post_datetime_split_list = post_datetime_value?.split('||')
9+
const post_datetime_type = post_datetime_split_list[0]?.trim()?.toLowerCase()
10+
const post_datetime_icon = post_datetime_split_list[1]?.trim()?.toLowerCase()
11+
12+
const post_datetime_created_icon = post_datetime_icon || 'fa-solid fa-file-circle-plus'
13+
const post_datetime_updated_icon = post_datetime_icon || 'fa-solid fa-history'
14+
15+
const home_post_block_datetime_icon = post_datetime_type === 'created' ? post_datetime_created_icon : post_datetime_updated_icon
16+
const home_post_block_datetime = post_datetime_type === 'created' ? post.date : post.updated
717
%>
818
919
<div class="post-meta-info-container border-box <%= page_type %>">

0 commit comments

Comments
 (0)