Skip to content

Commit

Permalink
feat: 多元列表允许限制概要行数
Browse files Browse the repository at this point in the history
  • Loading branch information
HowieHz committed Jan 12, 2025
1 parent 7b3eb68 commit fbd8527
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
6 changes: 6 additions & 0 deletions i18n-settings/settings.en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,12 @@ spec:
value: true
- label: Disable
value: false
- $formkit: number
name: post_excerpt_max_lines
if: "$post_list_layout === 'post-list-summary'"
label: Maximum number of lines in the post list summary
value: 3
help: "The value range is 1-5"
- $formkit: radio
name: is_show_index_post_list_permalink_text
if: "$post_list_layout === 'post-list-summary'"
Expand Down
6 changes: 6 additions & 0 deletions settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,12 @@ spec:
value: true
- label: 关闭
value: false
- $formkit: number
name: post_excerpt_max_lines
if: "$post_list_layout === 'post-list-summary'"
label: 多元列表文章摘要行数上限
value: 3
help: "填写值范围为 1-5"
- $formkit: radio
name: is_show_index_post_list_permalink_text
if: "$post_list_layout === 'post-list-summary'"
Expand Down
2 changes: 1 addition & 1 deletion templates/assets/dist/style.css

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions templates/fragments/posts.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,15 @@ <h2 class="static m-0 text-base font-semibold tracking-tight color-text">
<span th:text="${post.stats?.visit}">文章阅读量替换位</span>
</div>
</th:block>
<th:block th:if="${theme.config?.index_styles?.is_show_post_excerpt_in_post_list_summary}">
<p class="p-0 mb-0 relative z-10 mt-2 text-sm color-accent-3" th:text="${post.status?.excerpt}">
<th:block
th:if="${theme.config?.index_styles?.is_show_post_excerpt_in_post_list_summary}"
th:with="max_lines=${theme.config?.index_styles?.post_excerpt_max_lines}"
>
<p
class="p-0 mb-0 relative z-10 mt-2 text-sm color-accent-3"
th:text="${post.status?.excerpt}"
th:classappend="|${max_lines == '1' ? 'line-clamp-1' : ''} ${max_lines == '2' ? 'line-clamp-2' : ''} ${max_lines == '3' ? 'line-clamp-3' : ''} ${max_lines == '4' ? 'line-clamp-4' : ''} ${max_lines == '5' ? 'line-clamp-5' : ''}|"
>
文章概要替换位
</p>
</th:block>
Expand Down

0 comments on commit fbd8527

Please sign in to comment.