屏蔽空内容;接入搜索引擎;新增详情页面

This commit is contained in:
anian
2026-07-18 19:41:46 +08:00
parent 239bbf84f3
commit edd12b6488
10 changed files with 422 additions and 43 deletions
@@ -0,0 +1,133 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" th:content="${friend.spec.description ?: '无内容'}">
<title th:text="${site.title + '-' + (friend.spec.title ?: friend.spec.author)}"></title>
<link data-n-head="true" rel="icon" type="image/x-icon" th:href="${site.favicon}">
<style>
body {
margin: 0;
color: #242424;
background: #f7f7f7;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
Arial, "Noto Sans", sans-serif;
line-height: 1.8;
}
a {
color: #666;
text-decoration: none;
}
a:hover {
color: #111;
}
.wrapper {
max-width: 820px;
margin: 60px auto 32px;
padding: 56px;
background: #fff;
box-shadow: 0 10px 20px 0 hsla(0, 0%, 93%, .86);
}
.back {
display: inline-block;
margin-bottom: 28px;
color: #888;
font-size: 14px;
}
h1 {
margin: 0 0 18px;
color: #1f1f1f;
font-size: 28px;
line-height: 1.35;
}
.meta {
display: flex;
flex-wrap: wrap;
gap: 12px 18px;
margin-bottom: 36px;
color: #888;
font-size: 14px;
}
.author {
display: inline-flex;
align-items: center;
gap: 8px;
}
.author img {
width: 24px;
height: 24px;
border-radius: 50%;
object-fit: cover;
}
.content {
color: #333;
font-size: 16px;
white-space: pre-wrap;
word-break: break-word;
}
.actions {
margin-top: 40px;
padding-top: 24px;
border-top: 1px solid #eee;
}
footer {
margin: 0 auto 40px;
color: #999;
font-size: 13px;
text-align: center;
}
@media (max-width: 760px) {
.wrapper {
margin: 0;
padding: 32px 22px;
min-height: 100vh;
box-shadow: none;
}
h1 {
font-size: 24px;
}
}
</style>
</head>
<body>
<article class="wrapper">
<a class="back" href="/friends">返回朋友圈</a>
<h1 th:text="${friend.spec.title ?: '无内容'}"></h1>
<div class="meta">
<span class="author">
<img th:if="${friend.spec.logo != null and not #strings.isEmpty(friend.spec.logo)}"
th:src="${friend.spec.logo}" alt="">
<a th:if="${friend.spec.authorUrl != null and not #strings.isEmpty(friend.spec.authorUrl)}"
th:href="${friend.spec.authorUrl}" target="_blank" rel="noopener noreferrer"
th:text="${friend.spec.author}"></a>
<span th:unless="${friend.spec.authorUrl != null and not #strings.isEmpty(friend.spec.authorUrl)}"
th:text="${friend.spec.author}"></span>
</span>
<time th:if="${friend.spec.pubDate != null}"
th:datetime="${#dates.format(friend.spec.pubDate,'yyyy-MM-dd')}"
th:text="${#dates.format(friend.spec.pubDate,'yyyy.MM.dd')}"></time>
</div>
<div class="content" th:text="${friend.spec.description ?: '无内容'}"></div>
<div class="actions" th:if="${friend.spec.postLink != null and not #strings.isEmpty(friend.spec.postLink)}">
<a th:href="${friend.spec.postLink}" target="_blank" rel="noopener noreferrer">查看原文</a>
</div>
</article>
<footer>
<span>©2024 [[${site.title}]]</span>
</footer>
</body>
</html>
+4 -3
View File
@@ -1511,9 +1511,10 @@
<main>
<section class="article-list">
<article th:each="friend : ${friends.items}">
<h2><a th:href="${friend.spec.postLink}" target="_blank" th:text="${friend.spec.title}"></a></h2>
<h2><a th:href="@{/friends/{name}(name=${friend.metadata.name})}"
th:text="${friend.spec.title ?: '无内容'}"></a></h2>
<div class="excerpt">
<p th:text="${friend.spec.description}"></p>
<p th:text="${friend.spec.description ?: '无内容'}"></p>
</div>
<div class="meta">
<span class="item">
@@ -1556,4 +1557,4 @@
</body>
</html>
</html>