修复侧边栏最近发布模块显示与置顶文章冲突的问题

detailed:
1.更新主题版本号为1.0.3-ce。
2.更新主题最低Halo版本要求为>=2.15.0。
3.增加主题问题反馈地址。
4.增加主题协议。
5.修复侧边栏最近发布模块一直显示置顶文章的问题。
This commit is contained in:
UPToZ 2024-06-21 01:03:20 +08:00
parent 66417cb511
commit 9bca332716
5 changed files with 50 additions and 22 deletions

View File

@ -311,7 +311,7 @@ document.addEventListener('scroll', btf.throttle(function () {
//友链随机传送 //友链随机传送
function travelling() { function travelling() {
function getLinks() { function getLinks() {
const links = "/apis/api.plugin.halo.run/v1alpha1/plugins/PluginLinks/links?keyword=&sort=priority,asc" const links = "/apis/api.plugin.halo.run/v1alpha1/plugins/PluginLinks/links?keyword="
fetch(links) fetch(links)
.then(res => res.json()) .then(res => res.json())
.then(json => { .then(json => {

View File

@ -4,7 +4,7 @@
<div class="item-headline"><a class="card-more-btn" href="/archives/" title="查看更多" data-pjax-state=""></a></div> <div class="item-headline"><a class="card-more-btn" href="/archives/" title="查看更多" data-pjax-state=""></a></div>
<ul class="card-archive-list" <ul class="card-archive-list"
th:with="archives = ${postFinder.archives(1,1000)}, archivesQuantity = ${#conversions.convert(theme.config.sidebar.archivesQuantity, 'java.lang.Integer')}"> th:with="archives = ${postFinder.archives(1,0)}, archivesQuantity = ${#conversions.convert(theme.config.sidebar.archivesQuantity, 'java.lang.Integer')}">
<th:block th:each="archive,archiveStat : ${archives.items}"> <th:block th:each="archive,archiveStat : ${archives.items}">
<li class="card-archive-list-item" <li class="card-archive-list-item"
th:each="month,monthIndex : ${archive.months}" th:each="month,monthIndex : ${archive.months}"

View File

@ -1,24 +1,48 @@
<div class="card-widget card-recent-post card-article" th:with='posts = ${postFinder.list(1,theme.config.sidebar.recentPost)}, <!-- <div class="card-widget card-recent-post card-article" th:with='posts = ${postFinder.list(1,theme.config.sidebar.recentPost)}, -->
<div class="card-widget card-recent-post" th:with='
postRandomImg=${#strings.contains(theme.config.layout.postRandomImg,"?") ? theme.config.layout.postRandomImg+"&" : theme.config.layout.postRandomImg+"?"}'> postRandomImg=${#strings.contains(theme.config.layout.postRandomImg,"?") ? theme.config.layout.postRandomImg+"&" : theme.config.layout.postRandomImg+"?"}'>
<div class="item-headline"><i class="haofont hao-icon-eicon_map-2-line1"></i><span>最近发布</span></div> <div class="item-headline"><i class="haofont hao-icon-eicon_map-2-line1"></i><span>最近发布</span></div>
<div class="aside-list"> <div class="aside-list">
<!-- 最新文章,用户可以自定义展示数量 --> <!-- 最新文章,用户可以自定义展示数量 -->
<div class="aside-list-item" th:each="post : ${posts}"> <th:block th:with="archives = ${postFinder.archives(1,#conversions.convert(theme.config.sidebar.recentPost, 'java.lang.Integer'))}">
<a class="thumbnail" th:href="@{${post.status.permalink}}" th:title="${post.spec.title}"> <th:block th:each="archive : ${archives.items}">
<img th:alt="${post.spec.title}" <th:block th:each="month : ${archive.months}">
th:with="img = ${#strings.isEmpty(post.spec.cover) ? postRandomImg+post.spec.title : post.spec.cover}" <div class="aside-list-item" th:each="post : ${month.posts}">
<a class="thumbnail" th:href="@{${post.status.permalink}}" th:title="${post.spec.title}">
<img th:alt="${post.spec.title}"
th:with="img = ${#strings.isEmpty(post.spec.cover) ? postRandomImg+post.spec.title : post.spec.cover}"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}"> th:data-lazy-src="${ isLazyload ? img : ''}">
</a> </a>
<div class="content"> <div class="content">
<a class="title" th:href="@{${post.status.permalink}}" th:text="${post.spec.title}" th:title="${post.spec.title}"></a> <a class="title" th:href="@{${post.status.permalink}}" th:text="${post.spec.title}" th:title="${post.spec.title}"></a>
<time th:attr="datetime=${#dates.format(post.spec.publishTime, 'yyyy-MM-dd HH:mm:ss')}" <time th:attr="datetime=${#dates.format(post.spec.publishTime, 'yyyy-MM-dd HH:mm:ss')}"
th:text="${#dates.format(post.spec.publishTime,'yyyy-MM-dd HH:mm:ss')}" th:text="${#dates.format(post.spec.publishTime,'yyyy-MM-dd HH:mm:ss')}"
th:title="${#dates.format(post.spec.publishTime,'yyyy-MM-dd HH:mm:ss')}"> th:title="${#dates.format(post.spec.publishTime,'yyyy-MM-dd HH:mm:ss')}">
</time> </time>
</div> </div>
</div> </div>
</th:block>
</th:block>
</th:block>
<!-- 以下代码会将置顶的文章也显示在最近发布 -->
<!-- <div class="aside-list-item" th:each="post : ${posts}">
<a class="thumbnail" th:href="@{${post.status.permalink}}" th:title="${post.spec.title}">
<img th:alt="${post.spec.title}"
th:with="img = ${#strings.isEmpty(post.spec.cover) ? postRandomImg+post.spec.title : post.spec.cover}"
th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}">
</a>
<div class="content">
<a class="title" th:href="@{${post.status.permalink}}" th:text="${post.spec.title}" th:title="${post.spec.title}"></a>
<time th:attr="datetime=${#dates.format(post.spec.publishTime, 'yyyy-MM-dd HH:mm:ss')}"
th:text="${#dates.format(post.spec.publishTime,'yyyy-MM-dd HH:mm:ss')}"
th:title="${#dates.format(post.spec.publishTime,'yyyy-MM-dd HH:mm:ss')}">
</time>
</div>
</div> -->
</div> </div>
</div> </div>

View File

@ -62,7 +62,7 @@
<!-- 底部展示时间归档 --> <!-- 底部展示时间归档 -->
<div class="console-card history" onclick="heo.hideConsole()"> <div class="console-card history" onclick="heo.hideConsole()">
<div class="item-headline"><i class="fas fa-archive"></i><span>文章</span></div> <div class="item-headline"><i class="fas fa-archive"></i><span>文章</span></div>
<ul class="card-archive-list" th:with="archives = ${postFinder.archives(1,1000)}"> <ul class="card-archive-list" th:with="archives = ${postFinder.archives(1,0)}">
<th:block th:each="archive : ${archives.items}"> <th:block th:each="archive : ${archives.items}">
<li class="card-archive-list-item" th:each="month,monthStat : ${archive.months}"> <li class="card-archive-list-item" th:each="month,monthStat : ${archive.months}">
<a class="card-archive-list-link" th:href="@{'/archives/'+${archive.year}+'/'+${month.month}}" <a class="card-archive-list-link" th:href="@{'/archives/'+${archive.year}+'/'+${month.month}}"

View File

@ -49,7 +49,11 @@ spec:
logo: /themes/theme-hao/assets/images/hao-logo.jpg logo: /themes/theme-hao/assets/images/hao-logo.jpg
website: https://blog.uptoz.cn website: https://blog.uptoz.cn
repo: https://gitea.uptoz.cn/UPToZ/halo-theme-hao repo: https://gitea.uptoz.cn/UPToZ/halo-theme-hao
issues: https://gitee.com/uptoz/halo-theme-hao/issues
settingName: "theme-hao-setting" settingName: "theme-hao-setting"
configMapName: "theme-hao-configMap" configMapName: "theme-hao-configMap"
version: "1.0.2-ce" version: "1.0.3-ce"
require: ">=2.10.0" require: ">=2.15.0"
license:
- name: "CC BY-SA 4.0"
url: "https://gitee.com/uptoz/halo-theme-hao/blob/main/LICENSE"