feat: add option to show or hide the pin icon

This commit is contained in:
Erzbir
2025-11-18 11:30:55 +08:00
parent 6e0c498429
commit ad6f94ee5b
3 changed files with 34 additions and 0 deletions
+14
View File
@@ -33,6 +33,20 @@ spec:
label: 归档页显示文章标签
value: false
- $formkit: checkbox
name: show_pin
label: 主页置顶文章显示 pin 图标
value: true
- $formkit: select
name: pin_pos
label: pin 图标显示位置
options:
- label: "left"
value: "pin-left"
- label: "above"
value: "pin-above"
- $formkit: text
name: archives_title
label: 归档页标题自定义
+12
View File
@@ -53,6 +53,18 @@
font-weight: 400;
}
.pin, .pin svg {
width: calc(1em * 0.8);
}
.pin.pin-left {
display: inline;
}
.pin.pin-above {
display: block;
}
.post-title::after {
content: "";
position: absolute;
+8
View File
@@ -16,6 +16,14 @@
<article class="post on-list" th:each="post : ${posts.items}">
<header>
<h1 class="post-title">
<span class="pin" th:classappend="${theme.config?.page?.pin_pos}" th:if="${post.spec.pinned} and ${theme.config?.page?.show_pin}">
<svg class="icon-regular" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path fill="currentColor" d="M5 2h14a1 1 0 0 1 1 1v19.143a.5.5 0 0 1-.766.424L12 18.03l-7.234 4.536A.5.5 0 0 1 4 22.143V3a1 1 0 0 1 1-1m13 2H6v15.432l6-3.761l6 3.761z" />
</svg>
<svg class="icon-pixel" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path fill="currentColor" d="M18 2H6v2h12v16h-2v-2h-2v-2h-4v2H8v2H6V2H4v20h4v-2h2v-2h4v2h2v2h4V2z" />
</svg>
</span>
<a data-pjax th:text="${post.spec.title}" th:href="@{${post.status.permalink}}">Post Title</a>
</h1>
<div class="post-meta">