summaryrefslogtreecommitdiffstats
path: root/layouts
diff options
context:
space:
mode:
authoryingyu5658 <i@yingyu5658.me>2026-01-13 22:33:08 +0800
committeryingyu5658 <i@yingyu5658.me>2026-01-13 22:33:08 +0800
commit4c40685be4a919f4483febc6fc9249fa59651fae (patch)
tree29f0c9b66f5d90a5d808b84355148f6577c6d54e /layouts
parent16e2a3fd905c5ffb5e0a90c1a4805559d372b389 (diff)
downloadblog-4c40685be4a919f4483febc6fc9249fa59651fae.tar.gz
blog-4c40685be4a919f4483febc6fc9249fa59651fae.zip
style: show the summary of every post on recent-posts
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/baseof.html1
-rw-r--r--layouts/_default/single.html5
-rw-r--r--layouts/index.html4
-rw-r--r--layouts/partials/custom_head.html7
-rw-r--r--layouts/partials/footer.html2
-rw-r--r--layouts/partials/header.html5
-rw-r--r--layouts/partials/style.html53
-rw-r--r--layouts/shortcodes/mastodon.html16
-rw-r--r--layouts/shortcodes/recent-posts.html55
9 files changed, 85 insertions, 63 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index ea312f9..72b2954 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -22,7 +22,6 @@
</head>
<body>
- <header>{{- partial "header.html" . -}}</header>
<main>{{- block "main" . }}{{- end }}</main>
<footer>{{- partial "footer.html" . -}}</footer>
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 38c4c28..b16d254 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -1,6 +1,5 @@
-{{ define "main" }} {{ if eq .Type "blog" }} {{ if not .Params.menu }}
-<h1>{{ .Title }}</h1>
-{{ end }} {{ end }}
+{{ define "main" }}
+<header>{{- partial "header.html" . -}}</header>
<article class="h-entry">
<h1 class="post-title p-name"><a href="{{ .RelPermalink }}" style="color:#222222;">{{ .Title }}</a></h1>
diff --git a/layouts/index.html b/layouts/index.html
index d975ecb..2c47df5 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -1 +1,3 @@
-{{ define "main" }} {{ .Content }} {{ end }}
+{{ define "main" }}
+<header>{{- partial "header.html" . -}}</header>
+{{ .Content }} {{ end }}
diff --git a/layouts/partials/custom_head.html b/layouts/partials/custom_head.html
index a485758..ba9276e 100644
--- a/layouts/partials/custom_head.html
+++ b/layouts/partials/custom_head.html
@@ -14,10 +14,7 @@
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"
-/>
-<link
+/><link
rel="stylesheet"
- href="https://cdn.jsdelivr.net/npm/@idotj/mastodon-embed-timeline@4.7.0/dist/mastodon-timeline.min.css"
- integrity="sha256-Qi3H+bdH6RuMuyR1trAlG5bMWJGl9y3jPiTc1PWQFpI="
- crossorigin="anonymous"
+ href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"
/>
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index 5c8683c..3f0ea30 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -1,6 +1,6 @@
<div class="copyright">
{{ .Site.Params.footer.content }}
- <div class="social-icons">
+ <div class="rss-icon">
<a href="/atom.xml">
<i class="fa fa-rss"></i>
</a>
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index 9b49dfb..50b5fcb 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -2,4 +2,9 @@
<h1>{{ .Site.Title }}</h1>
</a>
<nav>{{- partial "nav.html" . -}}</nav>
+<div class="social-icons">
+ <a href="https://c7.io/@Verdant"><i class="fa-brands fa-mastodon"></i></a>
+ <a href="https://github.com/yingyu5658/"><i class="fa-brands fa-github"></i></a>
+ <a href="mailto:i@glowisle.me"><i class="fa-solid fa-envelope"></i></a>
+</div>
<hr>
diff --git a/layouts/partials/style.html b/layouts/partials/style.html
index 8429fdb..731db51 100644
--- a/layouts/partials/style.html
+++ b/layouts/partials/style.html
@@ -27,6 +27,23 @@
--music-text-secondary: #666;
--music-shadow:
0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
+ --summary-text-color: #4e4e4e;
+ }
+
+ div.summary a,
+ div.summary strong,
+ div.summary p {
+ color: var(--summary-text-color) !important;
+ }
+
+ .social-icons {
+ margin: 15px;
+ margin-top: 5px;
+ text-align: center;
+ }
+
+ .social-icons a {
+ padding: 5px 5px;
}
.booklist {
@@ -52,7 +69,7 @@
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}
- .social-icons {
+ .rss-icon {
display: inline;
font-size: 16px;
float: right;
@@ -272,6 +289,7 @@
/* 暗色模式 */
@media (prefers-color-scheme: dark) {
:root {
+ --summary-text-color: #b4b4b4;
--body-bg-color: #121212;
--bold-text-color: #eee;
--body-text-color: #ddd;
@@ -293,8 +311,12 @@
--color-background: var(--body-bg-color) !important;
}
- blockquote strong {
- font-weight: 600;
+ div.summary a {
+ text-decoration: underline 0.2px #6f6f6f;
+ }
+
+ strong {
+ font-weight: 650;
}
article p {
@@ -385,12 +407,12 @@
color: var(--bold-text-color);
}
- h1,
- h2,
- h3,
- h4,
- h5,
- h6 {
+ article h1,
+ article h2,
+ article h3,
+ article h4,
+ article h5,
+ article h6 {
margin: 16px 0;
}
@@ -407,13 +429,17 @@
}
.title {
- text-decoration: none;
- border: 0;
+ text-align: center;
+ text-decoration: none !important;
+ }
+
+ a.title h1 {
+ margin: 15px;
+ margin-bottom: 15px;
}
header {
margin-top: 30px;
- margin-bottom: 30px;
}
.title:hover {
@@ -425,7 +451,8 @@
}
nav {
- margin-bottom: 15px;
+ text-align: center;
+ margin-bottom: 20px;
}
nav a {
diff --git a/layouts/shortcodes/mastodon.html b/layouts/shortcodes/mastodon.html
index cfb15ca..e69de29 100644
--- a/layouts/shortcodes/mastodon.html
+++ b/layouts/shortcodes/mastodon.html
@@ -1,16 +0,0 @@
-<script type="module" src="https://unpkg.com/mastodon-widget"></script>
-
-<mastodon-widget account="Verdant@c7.io" limit="10" header="true">
-</mastodon-widget>
-
-<style>
- header,
- .post-title,
- .post-info {
- display: none !important;
- }
-
- mastodon-weight {
- background-color: black !important;
- }
-</style>
diff --git a/layouts/shortcodes/recent-posts.html b/layouts/shortcodes/recent-posts.html
index 7b3d855..297a760 100644
--- a/layouts/shortcodes/recent-posts.html
+++ b/layouts/shortcodes/recent-posts.html
@@ -1,7 +1,17 @@
-{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
-{{ $recent := first 8 $pages.ByDate.Reverse }}
+{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} {{
+$recent := first 8 $pages.ByDate.Reverse }}
<style>
+
+hr.item-split {
+ margin-bottom: 10px;
+ margin-top: 10px;
+ }
+
+ p {
+ line-height: 35px;
+ }
+
.recent-list {
margin: 0;
}
@@ -44,23 +54,22 @@
}
.split {
- margin: 0;
- padding: 0;
- display: inline;
+ margin: 0;
+ padding: 0;
+ display: inline;
}
.recent-posts-item {
- margin-top: 0;
- margin-bottom: 35px;
+ margin-top: 0;
+ margin-bottom: 0;
}
.recent-post-title {
- margin-top: 2px;
- margin-bottom: -10px;
+ margin-top: 2px;
+ margin-bottom: -10px;
}
@media (max-width: 720px) {
-
.post-date {
min-width: auto;
font-size: 0.85em;
@@ -70,7 +79,7 @@
font-size: 1.05em;
}
- .item-link {
+ .item-link {
white-space: normal; /* 允许换行 */
word-wrap: break-word; /* 强制长单词/链接换行 */
overflow: visible; /* 取消隐藏 */
@@ -80,16 +89,10 @@
</style>
<div class="recent-posts">
- {{ if $recent }}
- {{ range $index, $page := $recent }}
- <div class="recent-posts-item">
- <h3 class="recent-post-title">
- <a href="{{ .RelPermalink }}" class="item-link">{{ .Title }}</a>
- </h3>
-
+ {{ if $recent }} {{ range $index, $page := $recent }}
<div class="post-meta">
<span class="post-date">
- <time datetime='{{ .Date.Format "Jan 02, 2006" }}'>{{- .Date.Format (default "Jan 02, 2006" .Site.Params.dateFormat) -}}•</time>
+ <time datetime='{{ .Date.Format "Jan 02, 2006" }}'>{{- .Date.Format (default "Jan 02, 2006" .Site.Params.dateFormat) -}}·</time>
</span>
{{ with .Params.categories }}
@@ -103,9 +106,15 @@
{{ end }}
{{ end }}
</div>
- </div>
- {{ end }}
- {{ else }}
- <div class="recent-empty">暂无文章</div>
+ <div class="recent-posts-item">
+ <h3 class="recent-post-title">
+ <a href="{{ .RelPermalink }}" class="item-link">{{ .Title }}</a>
+ </h3>
+
+ <div class="summary">{{ .Summary }}</div>
+ </div>
+ <hr class="item-split">
+ {{ end }} {{ else }}
+ <div class="recent-empty">暂无文章</div>
{{ end }}
</div>