refactor(theme): improve archive link resolution logic and dynamic tab naming

这个提交包含在:
2026-06-16 17:37:21 +08:00 未验证
父节点 507a43ecd3
当前提交 b176fce4a9
修改 3 个文件,包含 23 行新增8 行删除
+8 -2
查看文件
@@ -8,12 +8,18 @@
<div class="devcm-editor-tabs">
<div
class="devcm-editor-tab devcm-editor-tab--active"
th:with="postTabName=${!#strings.isEmpty(post.spec.slug) ? post.spec.slug : post.metadata.name}"
th:with="postTabBaseName=${!#strings.isEmpty(post.spec.slug) ? post.spec.slug : post.metadata.name},
postTabName=${#strings.endsWith(postTabBaseName, '.md') ? postTabBaseName : postTabBaseName + '.md'},
primaryMenu=${menuFinder.getPrimary()},
archiveMenuItem=${primaryMenu != null and primaryMenu.menuItems != null and !#lists.isEmpty(primaryMenu.menuItems) ? primaryMenu.menuItems.^[status != null and !#strings.isEmpty(status.href) and ((spec != null and spec.href == '/archives') or status.href == '/archives' or status.displayName == 'Archives' or status.displayName == '归档')] : null},
archiveActivityItem=${theme.config.activity.activity_items != null and !#lists.isEmpty(theme.config.activity.activity_items) ? theme.config.activity.activity_items.^[type == 'archive' or key == 'archive'] : null},
postCloseHref=${archiveMenuItem != null and archiveMenuItem.status != null and !#strings.isEmpty(archiveMenuItem.status.href) ? archiveMenuItem.status.href : (archiveActivityItem != null and !#strings.isEmpty(archiveActivityItem.url) ? archiveActivityItem.url : (archiveActivityItem != null and !#strings.isEmpty(archiveActivityItem.href) ? archiveActivityItem.href : '/archives'))}"
>
<span th:text="${postTabName}">post</span>
<a
class="devcm-editor-tab__close"
href="/archives"
href="#"
th:href="${postCloseHref}"
th:aria-label="#{devcm.action.closePostTab}"
th:title="#{devcm.action.closePostTab}"
>×</a