|
1 | 1 | <!-- using ring to avoid border wrapping around post thumbnail --> |
2 | | -<li data-home-card class="relative flex box-border flex-col mb-6 overflow-hidden rounded-2xl ring-inset ring ring-rd-gray-alpha-400 bg-rd-background-100 sm:mb-8 md:mb-10 group"> |
| 2 | +<li data-home-card class="relative flex box-border flex-col mb-6 overflow-hidden rounded-2xl ring-inset ring ring-rd-gray-alpha-400 sm:mb-8 md:mb-10 group"> |
3 | 3 | <% if (post.sticky) { %> |
4 | 4 | <div data-sticky-label class="absolute top-3 right-3 z-10 cursor-default rounded-full border border-rd-gray-alpha-400 bg-rd-background-100/15 px-2.5 py-0.5 text-xs text-rd-gray-900 hover:text-rd-gray-1000"> |
5 | 5 | <i class="fa-regular fa-thumbtack mr-1 text-xs" aria-hidden="true"></i><%- __('sticky') %> |
|
44 | 44 | <% } %> |
45 | 45 | </div> |
46 | 46 |
|
47 | | - <div class="flex items-center justify-between text-sm text-rd-gray-900"> |
48 | | - <div class="tracking-normal [&_a]:text-rd-gray-900 [&_a:hover]:text-primary"> |
49 | | - <span class="mr-2.5"><i class="fa-solid fa-calendars" aria-hidden="true"></i> |
| 47 | + <div class="flex items-center justify-between gap-4 text-sm text-rd-gray-900"> |
| 48 | + <div class="flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1 tracking-normal [&_a]:text-rd-gray-900 [&_a:hover]:text-primary"> |
| 49 | + <span class="flex items-center"><i class="fa-solid fa-calendars" aria-hidden="true"></i> |
50 | 50 | <time data-home-article-date data-date="<%= post.date %>" datetime="<%= date_xml(post.date) %>"> |
51 | 51 | <% if (theme.home.article_date_format == 'auto' || theme.home.article_date_format == 'relative') { %> |
52 | 52 | <%= date(post.date, config.date_format) %> |
|
56 | 56 | </time> |
57 | 57 | </span> |
58 | 58 | <% if (post.categories.length && theme.home.categories.enable === true) { %> |
59 | | - <span class="mr-2.5 hidden sm:inline"> |
60 | | - <i class="fa-solid fa-folders" aria-hidden="true"></i> |
61 | | - <ul class="inline"> |
62 | | - <% let previousParentId = null; %> |
63 | | - <% post.categories.forEach((category) => { %> |
64 | | - <% if (previousParentId !== category.parent) { %> |
65 | | - <% if (previousParentId !== null) { %><li class="inline">></li><% } %> |
66 | | - <li class="inline"><a href="<%- url_for(category.path) %>"><%= category.name %></a> </li> |
67 | | - <% } else { %> |
68 | | - <li class="inline">| <a href="<%- url_for(category.path) %>"><%= category.name %></a> </li> |
69 | | - <% } %> |
70 | | - <% previousParentId = category.parent; %> |
| 59 | + <% |
| 60 | + const categoryPaths = getCategoryPaths(post.categories); |
| 61 | + const categoryLimit = Number(theme.home.categories.limit); |
| 62 | + const visibleCategoryPaths = categoryLimit > 0 ? categoryPaths.slice(0, categoryLimit) : categoryPaths; |
| 63 | + %> |
| 64 | + <div class="hidden min-w-0 items-center gap-1.5 sm:flex"> |
| 65 | + <i class="fa-regular fa-folders shrink-0" aria-hidden="true"></i> |
| 66 | + <ul class="flex min-w-0 flex-wrap gap-1.5" aria-label="<%= __('categories') %>"> |
| 67 | + <% visibleCategoryPaths.forEach((categoryPath) => { %> |
| 68 | + <li data-home-category-path class="flex max-w-full items-center rounded-md border border-rd-gray-alpha-300 bg-rd-gray-100/30 px-2 py-0.5 text-xs"> |
| 69 | + <% categoryPath.forEach((category, index) => { %> |
| 70 | + <% if (index > 0) { %><i class="fa-regular fa-angle-right mx-1 shrink-0 text-xs text-rd-gray-800" aria-hidden="true"></i><% } %> |
| 71 | + <a class="min-w-0 truncate" href="<%- url_for(category.path) %>"><%= category.name %></a> |
| 72 | + <% }); %> |
| 73 | + </li> |
71 | 74 | <% }); %> |
72 | 75 | </ul> |
73 | | - </span> |
| 76 | + </div> |
74 | 77 | <% } %> |
75 | 78 | <% if (post.tags.length && theme.home.tags.enable === true) { %> |
76 | | - <span class="mr-2.5 hidden last:mr-0 md:inline"> |
77 | | - <i class="fa-solid fa-tags" aria-hidden="true"></i> |
78 | | - <ul class="inline"> |
| 79 | + <span class="hidden items-center gap-1.5 md:flex"> |
| 80 | + <i class="fa-solid fa-tags" aria-hidden="true"></i> |
| 81 | + <ul class="flex flex-wrap gap-1.5"> |
79 | 82 | <% post.tags.forEach((tag, i) => { %> |
80 | 83 | <% if (theme.home.tags.limit === 0 || i + 1 <= theme.home.tags.limit) { %> |
81 | | - <li class="inline"><%= i === 0 ? '' : '| ' %><a href="<%- url_for(tag.path) %>"><%= tag.name %></a> </li> |
| 84 | + <li class="flex"><a class="rounded-full border border-rd-gray-alpha-300 bg-rd-gray-100/30 px-2 py-0.5 text-xs text-rd-gray-900 hover:bg-rd-gray-alpha-300 hover:text-primary" href="<%- url_for(tag.path) %>"><%= tag.name %></a></li> |
82 | 85 | <% } %> |
83 | 86 | <% }); %> |
84 | 87 | </ul> |
|
87 | 90 | </div> |
88 | 91 |
|
89 | 92 | <a |
90 | | - class="group/read-more flex items-center gap-2" |
| 93 | + class="group/read-more flex shrink-0 items-center gap-2 whitespace-nowrap" |
91 | 94 | href="<%- url_for(post.path) %>" |
92 | 95 | > |
93 | 96 | <%- __('read_more') %> |
|
0 commit comments