aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/_index.md2
-rw-r--r--hugo.toml2
-rw-r--r--layouts/_default/baseof.html61
-rw-r--r--layouts/partials/header.html3
-rw-r--r--layouts/partials/style.html25
-rw-r--r--layouts/shortcodes/recent-posts.html77
6 files changed, 99 insertions, 71 deletions
diff --git a/content/_index.md b/content/_index.md
index 79c00f9..488c825 100644
--- a/content/_index.md
+++ b/content/_index.md
@@ -11,7 +11,5 @@ title: "映屿"
我会在这里写写生活随笔、读书感悟、技术实践和幼稚观点。
-->
- ---
-
{{< recent-posts >}}
diff --git a/hugo.toml b/hugo.toml
index b36ed61..2f68194 100644
--- a/hugo.toml
+++ b/hugo.toml
@@ -1,5 +1,5 @@
baseurl = "https://www.glowisle.me/"
-title = "🎄 映屿"
+title = "映屿"
hasCJKLanguage = true
enableRobotsTXT = true
pagination.pagerSize = 5
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 8729df0..ea312f9 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -1,43 +1,34 @@
-<!DOCTYPE html>
+<!doctype html>
<html lang="{{ with .Site.LanguageCode }}{{ . }}{{ else }}en-US{{ end }}">
-
-<head>
- <meta http-equiv="X-Clacks-Overhead" content="GNU Terry Pratchett" />
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- {{- partial "favicon.html" . -}}
- <title>{{ .Title }}</title>
-
- {{- partial "seo_tags.html" . -}}
- <meta name="referrer" content="no-referrer-when-downgrade" />
-
- {{ with .OutputFormats.Get "rss" -}}
- {{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
- {{ end -}}
-
- {{- partial "style.html" . -}}
-
- <!-- A partial to be overwritten by the user.
+ <head>
+ <meta http-equiv="X-Clacks-Overhead" content="GNU Terry Pratchett" />
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ {{- partial "favicon.html" . -}}
+ <title>{{ .Title }}</title>
+
+ {{- partial "seo_tags.html" . -}}
+ <meta name="referrer" content="no-referrer-when-downgrade" />
+
+ {{ with .OutputFormats.Get "rss" -}} {{ printf `
+ <link rel="%s" type="%s" href="%s" title="%s" />
+ ` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} {{ end -}} {{-
+ partial "style.html" . -}}
+
+ <!-- A partial to be overwritten by the user.
Simply place a custom_head.html into
your local /layouts/partials-directory -->
- {{- partial "custom_head.html" . -}}
-</head>
+ {{- partial "custom_head.html" . -}}
+ </head>
-<body>
- <header>
- {{- partial "header.html" . -}}
- </header>
- <main>
- {{- block "main" . }}{{- end }}
- </main>
- <footer>
- {{- partial "footer.html" . -}}
- </footer>
+ <body>
+ <header>{{- partial "header.html" . -}}</header>
+ <main>{{- block "main" . }}{{- end }}</main>
+ <footer>{{- partial "footer.html" . -}}</footer>
- <!-- A partial to be overwritten by the user.
+ <!-- A partial to be overwritten by the user.
Simply place a custom_body.html into
your local /layouts/partials-directory -->
- {{- partial "custom_body.html" . -}}
-</body>
-
+ {{- partial "custom_body.html" . -}}
+ </body>
</html>
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index 66fa74b..9b49dfb 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -1,4 +1,5 @@
<a href="{{ "" | relURL }}" class="title">
- <h1 class="site-name">{{ .Site.Title }}</h1>
+ <h1>{{ .Site.Title }}</h1>
</a>
<nav>{{- partial "nav.html" . -}}</nav>
+<hr>
diff --git a/layouts/partials/style.html b/layouts/partials/style.html
index 14b2eea..7d29d4e 100644
--- a/layouts/partials/style.html
+++ b/layouts/partials/style.html
@@ -1,7 +1,7 @@
<style>
/* light theme */
:root {
- --width-max: 720px;
+ --width-max: 700px;
--font-primary: "Noto Serif SC", "Source Han Serif SC", serif;
--font-secondary: monospace;
--font-size-primary: 1.105em;
@@ -36,8 +36,8 @@
nav a,
h1.post-title a,
- .category-link,
- .blog-posts li a {
+ .blog-posts li a,
+ a.category-link {
text-decoration: none !important;
}
@@ -48,6 +48,10 @@
text-decoration: underline 0.5px !important;
}
+ a.category-link:hover {
+ text-decoration: underline 0.5px !important;
+ }
+
.wm {
border: 1px #d0d7de solid;
border-radius: 0.25em;
@@ -62,7 +66,7 @@
}
article p {
- line-height: 40px;
+ line-height: 35px;
}
.item-link {
@@ -75,7 +79,7 @@
margin-bottom: 3vh;
}
.category-link {
- color: #999;
+ color: #444;
}
h1.post-title {
@@ -273,6 +277,10 @@
--toc-hover-color: #cac3c3;
}
+ .category-link {
+ color: #dbdbdb;
+ }
+
.wm {
background-color: #161b22;
border-color: #30363d;
@@ -372,6 +380,11 @@
border: 0;
}
+ header {
+ margin-top: 30px;
+ margin-bottom: 30px;
+ }
+
.title:hover {
text-decoration: none;
}
@@ -460,7 +473,7 @@
time {
font-family: var(--font-secondary);
font-size: 15px;
- color: rgb(163, 163, 163);
+ color: rgb(139, 139, 139);
}
code {
diff --git a/layouts/shortcodes/recent-posts.html b/layouts/shortcodes/recent-posts.html
index 14ce25e..7b3d855 100644
--- a/layouts/shortcodes/recent-posts.html
+++ b/layouts/shortcodes/recent-posts.html
@@ -1,10 +1,15 @@
-{{ $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>
.recent-list {
margin: 0;
}
+ .post-meta {
+ margin-bottom: 5px;
+ }
+
.recent-item {
position: relative;
margin-bottom: 8px;
@@ -29,25 +34,32 @@ $recent := first 8 $pages.ByDate.Reverse }}
flex-shrink: 0;
}
+ .category-link {
+ font-size: 0.9em;
+ }
+
.recent-empty {
text-align: center;
font-style: italic;
}
- .recent-post-item {
- margin-bottom: 1em;
+ .split {
+ margin: 0;
+ padding: 0;
+ display: inline;
+ }
+
+ .recent-posts-item {
+ margin-top: 0;
+ margin-bottom: 35px;
}
.recent-post-title {
- margin-top: 2px;
+ margin-top: 2px;
+ margin-bottom: -10px;
}
@media (max-width: 720px) {
- .recent-post-item {
- flex-direction: column; /* 改为上下排列 */
- gap: 4px; /* 缩短日期和标题的间距 */
- margin-bottom: 1.5em;
- }
.post-date {
min-width: auto;
@@ -58,7 +70,7 @@ $recent := first 8 $pages.ByDate.Reverse }}
font-size: 1.05em;
}
- .item-link {
+ .item-link {
white-space: normal; /* 允许换行 */
word-wrap: break-word; /* 强制长单词/链接换行 */
overflow: visible; /* 取消隐藏 */
@@ -66,21 +78,34 @@ $recent := first 8 $pages.ByDate.Reverse }}
}
}
</style>
+
<div class="recent-posts">
- {{ if $recent }} {{ range $index, $page := $recent }}
-
- <div class="recent-post-item">
- <span class="post-date">
- <time datetime='{{ .Date.Format "2006-01-02" }}'>
- {{ .Date.Format (default "2006-01-02" .Site.Params.dateFormat) }}
- </time>
- </span>
-
- <h3 class="recent-post-title">
- <a href="{{ .RelPermalink }}" class="item-link">{{ .Title }}</a>
- </h3>
- </div>
- {{ end }} {{ else }}
- <p class="recent-empty">暂无文章</p>
+ {{ 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>
+
+ <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>
+ </span>
+
+ {{ with .Params.categories }}
+ {{ range . }}
+ {{ $category := . }}
+ {{ with $.Site.GetPage (printf "categories/%s" $category) }}
+ <a href="{{ .Permalink }}" class="category-link">{{ .Title }}</a>
+ {{ else }}
+ <a href="{{ "categories/" | relLangURL}}{{ $category | urlize}}" class="category-link">{{ $category }}</a>
+ {{ end }}
+ {{ end }}
+ {{ end }}
+ </div>
+ </div>
+ {{ end }}
+ {{ else }}
+ <div class="recent-empty">暂无文章</div>
{{ end }}
</div>