refactor(theme): enhance link resolution logic for archives, categories, and tags
这个提交包含在:
+2
-2
@@ -78,14 +78,14 @@ spec:
|
|||||||
position: up
|
position: up
|
||||||
label: 分类
|
label: 分类
|
||||||
icon: script-text
|
icon: script-text
|
||||||
url: /categories
|
url: ""
|
||||||
external: false
|
external: false
|
||||||
- enabled: true
|
- enabled: true
|
||||||
type: tags
|
type: tags
|
||||||
position: up
|
position: up
|
||||||
label: 标签
|
label: 标签
|
||||||
icon: label
|
icon: label
|
||||||
url: /tags
|
url: ""
|
||||||
external: false
|
external: false
|
||||||
- enabled: true
|
- enabled: true
|
||||||
type: login
|
type: login
|
||||||
|
|||||||
+2
-1
@@ -10,7 +10,8 @@
|
|||||||
<span th:text="${category.spec.displayName} + '.md'">category.md</span>
|
<span th:text="${category.spec.displayName} + '.md'">category.md</span>
|
||||||
<a
|
<a
|
||||||
class="devcm-editor-tab__close"
|
class="devcm-editor-tab__close"
|
||||||
href="/categories"
|
href="#"
|
||||||
|
th:href="${!#strings.isEmpty(site.routes.categoriesUri) ? site.routes.categoriesUri : '/categories'}"
|
||||||
th:aria-label="#{devcm.action.closeCategoryTab}"
|
th:aria-label="#{devcm.action.closeCategoryTab}"
|
||||||
th:title="#{devcm.action.closeCategoryTab}"
|
th:title="#{devcm.action.closeCategoryTab}"
|
||||||
>×</a
|
>×</a
|
||||||
|
|||||||
@@ -16,10 +16,12 @@
|
|||||||
|
|
||||||
<th:block
|
<th:block
|
||||||
th:with="items=${theme.config.activity.activity_items},
|
th:with="items=${theme.config.activity.activity_items},
|
||||||
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=${items != null and !#lists.isEmpty(items) ? items.^[type == 'archive' or key == 'archive'] : null},
|
archiveActivityItem=${items != null and !#lists.isEmpty(items) ? items.^[type == 'archive' or key == 'archive'] : null},
|
||||||
activityArchiveHref=${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'))}"
|
categoriesActivityItem=${items != null and !#lists.isEmpty(items) ? items.^[type == 'categories' or key == 'categories'] : null},
|
||||||
|
tagsActivityItem=${items != null and !#lists.isEmpty(items) ? items.^[type == 'tags' or key == 'tags'] : null},
|
||||||
|
activityArchiveHref=${!#strings.isEmpty(site.routes.archivesUri) ? site.routes.archivesUri : (archiveActivityItem != null and !#strings.isEmpty(archiveActivityItem.url) ? archiveActivityItem.url : (archiveActivityItem != null and !#strings.isEmpty(archiveActivityItem.href) ? archiveActivityItem.href : '/archives'))},
|
||||||
|
activityCategoriesHref=${!#strings.isEmpty(site.routes.categoriesUri) ? site.routes.categoriesUri : (categoriesActivityItem != null and !#strings.isEmpty(categoriesActivityItem.url) ? categoriesActivityItem.url : (categoriesActivityItem != null and !#strings.isEmpty(categoriesActivityItem.href) ? categoriesActivityItem.href : '/categories'))},
|
||||||
|
activityTagsHref=${!#strings.isEmpty(site.routes.tagsUri) ? site.routes.tagsUri : (tagsActivityItem != null and !#strings.isEmpty(tagsActivityItem.url) ? tagsActivityItem.url : (tagsActivityItem != null and !#strings.isEmpty(tagsActivityItem.href) ? tagsActivityItem.href : '/tags'))}"
|
||||||
>
|
>
|
||||||
<div class="devcm-activity__group devcm-activity__group--up">
|
<div class="devcm-activity__group devcm-activity__group--up">
|
||||||
<th:block th:if="${items != null and !#lists.isEmpty(items)}">
|
<th:block th:if="${items != null and !#lists.isEmpty(items)}">
|
||||||
@@ -29,7 +31,7 @@
|
|||||||
itemType=${!#strings.isEmpty(item.type) ? item.type : (!#strings.isEmpty(item.key) ? item.key : 'custom')},
|
itemType=${!#strings.isEmpty(item.type) ? item.type : (!#strings.isEmpty(item.key) ? item.key : 'custom')},
|
||||||
entryAction=${itemType == 'search' or item.action == 'search' ? 'search' : 'link'},
|
entryAction=${itemType == 'search' or item.action == 'search' ? 'search' : 'link'},
|
||||||
entryConfiguredHref=${!#strings.isEmpty(item.url) ? item.url : (!#strings.isEmpty(item.href) ? item.href : '#')},
|
entryConfiguredHref=${!#strings.isEmpty(item.url) ? item.url : (!#strings.isEmpty(item.href) ? item.href : '#')},
|
||||||
entryHref=${entryAction == 'search' ? '#' : (itemType == 'archive' ? activityArchiveHref : entryConfiguredHref)},
|
entryHref=${entryAction == 'search' ? '#' : (itemType == 'archive' ? activityArchiveHref : (itemType == 'categories' ? activityCategoriesHref : (itemType == 'tags' ? activityTagsHref : entryConfiguredHref)))},
|
||||||
entryLabel=${!#strings.isEmpty(item.label) ? item.label : (!#strings.isEmpty(item.labelKey) ? #messages.msg(item.labelKey) : #messages.msg('devcm.activity.link'))}"
|
entryLabel=${!#strings.isEmpty(item.label) ? item.label : (!#strings.isEmpty(item.labelKey) ? #messages.msg(item.labelKey) : #messages.msg('devcm.activity.link'))}"
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
@@ -112,7 +114,8 @@
|
|||||||
<a
|
<a
|
||||||
class="devcm-activity__button"
|
class="devcm-activity__button"
|
||||||
th:classappend="${pageType == 'categories' or pageType == 'category'} ? ' devcm-activity__button--active' : ''"
|
th:classappend="${pageType == 'categories' or pageType == 'category'} ? ' devcm-activity__button--active' : ''"
|
||||||
href="/categories"
|
href="#"
|
||||||
|
th:href="${activityCategoriesHref}"
|
||||||
th:title="#{devcm.activity.categories}"
|
th:title="#{devcm.activity.categories}"
|
||||||
th:attr="data-label=#{devcm.activity.categories},aria-label=#{devcm.activity.categories}"
|
th:attr="data-label=#{devcm.activity.categories},aria-label=#{devcm.activity.categories}"
|
||||||
>
|
>
|
||||||
@@ -121,7 +124,8 @@
|
|||||||
<a
|
<a
|
||||||
class="devcm-activity__button"
|
class="devcm-activity__button"
|
||||||
th:classappend="${pageType == 'tags' or pageType == 'tag'} ? ' devcm-activity__button--active' : ''"
|
th:classappend="${pageType == 'tags' or pageType == 'tag'} ? ' devcm-activity__button--active' : ''"
|
||||||
href="/tags"
|
href="#"
|
||||||
|
th:href="${activityTagsHref}"
|
||||||
th:title="#{devcm.activity.tags}"
|
th:title="#{devcm.activity.tags}"
|
||||||
th:attr="data-label=#{devcm.activity.tags},aria-label=#{devcm.activity.tags}"
|
th:attr="data-label=#{devcm.activity.tags},aria-label=#{devcm.activity.tags}"
|
||||||
>
|
>
|
||||||
@@ -138,7 +142,7 @@
|
|||||||
itemType=${!#strings.isEmpty(item.type) ? item.type : (!#strings.isEmpty(item.key) ? item.key : 'custom')},
|
itemType=${!#strings.isEmpty(item.type) ? item.type : (!#strings.isEmpty(item.key) ? item.key : 'custom')},
|
||||||
entryAction=${itemType == 'search' or item.action == 'search' ? 'search' : 'link'},
|
entryAction=${itemType == 'search' or item.action == 'search' ? 'search' : 'link'},
|
||||||
entryConfiguredHref=${!#strings.isEmpty(item.url) ? item.url : (!#strings.isEmpty(item.href) ? item.href : '#')},
|
entryConfiguredHref=${!#strings.isEmpty(item.url) ? item.url : (!#strings.isEmpty(item.href) ? item.href : '#')},
|
||||||
entryHref=${entryAction == 'search' ? '#' : (itemType == 'archive' ? activityArchiveHref : entryConfiguredHref)},
|
entryHref=${entryAction == 'search' ? '#' : (itemType == 'archive' ? activityArchiveHref : (itemType == 'categories' ? activityCategoriesHref : (itemType == 'tags' ? activityTagsHref : entryConfiguredHref)))},
|
||||||
entryLabel=${!#strings.isEmpty(item.label) ? item.label : (!#strings.isEmpty(item.labelKey) ? #messages.msg(item.labelKey) : #messages.msg('devcm.activity.link'))}"
|
entryLabel=${!#strings.isEmpty(item.label) ? item.label : (!#strings.isEmpty(item.labelKey) ? #messages.msg(item.labelKey) : #messages.msg('devcm.activity.link'))}"
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
|
|||||||
+1
-3
@@ -10,10 +10,8 @@
|
|||||||
class="devcm-editor-tab devcm-editor-tab--active"
|
class="devcm-editor-tab devcm-editor-tab--active"
|
||||||
th:with="postTabBaseName=${!#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'},
|
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},
|
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'))}"
|
postCloseHref=${!#strings.isEmpty(site.routes.archivesUri) ? site.routes.archivesUri : (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>
|
<span th:text="${postTabName}">post</span>
|
||||||
<a
|
<a
|
||||||
|
|||||||
+2
-1
@@ -10,7 +10,8 @@
|
|||||||
<span th:text="'#' + ${tag.spec.displayName} + '.md'">tag.md</span>
|
<span th:text="'#' + ${tag.spec.displayName} + '.md'">tag.md</span>
|
||||||
<a
|
<a
|
||||||
class="devcm-editor-tab__close"
|
class="devcm-editor-tab__close"
|
||||||
href="/tags"
|
href="#"
|
||||||
|
th:href="${!#strings.isEmpty(site.routes.tagsUri) ? site.routes.tagsUri : '/tags'}"
|
||||||
th:aria-label="#{devcm.action.closeTagTab}"
|
th:aria-label="#{devcm.action.closeTagTab}"
|
||||||
th:title="#{devcm.action.closeTagTab}"
|
th:title="#{devcm.action.closeTagTab}"
|
||||||
>×</a
|
>×</a
|
||||||
|
|||||||
在新议题中引用
屏蔽一个用户