aboutsummaryrefslogtreecommitdiffstats
path: root/layouts
diff options
context:
space:
mode:
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/baseof.html4
-rw-r--r--layouts/partials/nav.html5
-rw-r--r--layouts/partials/style.html20
-rw-r--r--layouts/shortcodes/recent-posts.html160
4 files changed, 51 insertions, 138 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 21454e4..aad83c9 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -15,10 +15,6 @@
` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} {{ end -}}
{{- partial "style.html" . -}}
- <!-- {{- partial "style-min.html" . -}} -->
-
-
-
<!-- A partial to be overwritten by the user.
Simply place a custom_head.html into
your local /layouts/partials-directory -->
diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html
index 96bf26b..c9ace2f 100644
--- a/layouts/partials/nav.html
+++ b/layouts/partials/nav.html
@@ -1,6 +1,7 @@
+<a href="{{ "" | relURL }}">首页</a>
{{ range .Site.Menus.main }}
-<a href="{{ .URL }}">{{ .Name }}</a>
+<a href="{{ .URL }}">{{ .Name}}</a>
{{ end }}
{{ with .Site.GetPage "/blog" }}
-<a href="{{ "posts/" | relURL }}">Blog</a>
+<a href="{{ "blog/" | relURL }}">Blog</a>
{{ end }}
diff --git a/layouts/partials/style.html b/layouts/partials/style.html
index ec4dae2..0c11755 100644
--- a/layouts/partials/style.html
+++ b/layouts/partials/style.html
@@ -4,10 +4,10 @@
--font-secondary: monospace;
--font-size-primary: 1rem;
--font-size-secondary: .85rem;
- --body-bg-color: #ffffff;
+ --body-bg-color: #fbfbf6;
--bold-text-color: #222;
--body-text-color: #444;
- --link-color: #0066cc;
+ --link-color: #0355a6;
--link-visited-color: #551a8b;
--table-border-color: #f2f2f2;
--table-th-bg-color: #f2f2f2;
@@ -68,7 +68,7 @@ h1, h2 {
margin-top: 1.5em;
}
-.post-meta-item a, .rss-icon a, .post-title a, header a, a.title h1, p {
+.post-meta-item a, .rss-icon a, .post-title a, a.title h1, p {
color: var(--body-text-color)
}
@@ -140,7 +140,6 @@ time {
header {
margin-top: 30px;
-margin-bottom: 2rem;
}
.title {
@@ -161,18 +160,10 @@ a.title h1 {
font-weight: 400;
}
-nav {
- text-align: left;
- margin-bottom: 20px;
-}
-nav a {
- margin-right: 8px;
- text-decoration: none !important;
-}
-nav a:hover {
- text-decoration: underline 0.5px !important;
+nav a {
+ margin-right: 8px;
}
footer {
@@ -811,7 +802,6 @@ nav {
header {
margin-top: 30px;
- margin-bottom: 2rem;
display: block;
}
diff --git a/layouts/shortcodes/recent-posts.html b/layouts/shortcodes/recent-posts.html
index a666a4c..55f7cd4 100644
--- a/layouts/shortcodes/recent-posts.html
+++ b/layouts/shortcodes/recent-posts.html
@@ -1,136 +1,62 @@
-{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} {{
-$recent := first 6 $pages.ByDate.Reverse }}
+{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
+{{ $recent := first 12 $pages.ByDate.Reverse }}
<style>
- .item-link {
- word-wrap: break-word;
- white-space: normal;
- }
.recent-list {
- margin: 0;
- }
- .post-meta {
- margin-bottom: 5px;
+ list-style: none;
+ margin: 0;
+ padding: 0;
}
- .recent-item {
- position: relative;
- margin-bottom: 8px;
- flex-shrink: 0;
+ .recent-list li {
+ margin-bottom: 0.5em;
+ line-height: 1.4;
}
- .split {
- margin: 0;
- padding: 0;
- display: inline;
+ .recent-date {
+ font-family: monospace;
+ margin-right: 1.5em;
+ white-space: nowrap;
}
- .recent-posts-item {
- margin-top: 0;
- margin-bottom: 35px;
-
+ .recent-title {
+ word-wrap: break-word;
}
- .recent-post-title {
- margin-top: 2px;
- margin-bottom: -10px;
-
+ .recent-empty {
+ text-align: center;
+ font-style: italic;
}
@media (max-width: 720px) {
- .post-date {
- min-width: auto;
- font-size: 1.05em;
- }
- .item-link {
- white-space: normal; /* 允许换行 */
- word-wrap: break-word; /* 强制长单词/链接换行 */
- overflow: visible; /* 取消隐藏 */
- text-overflow: clip; /* 取消省略号 */
- }
+ .recent-list li {
+ display: flex;
+ flex-wrap: wrap;
+ }
+ .recent-date {
+ width: auto;
+ margin-right: 0.5em;
+ }
}
- .category-link {
- font-size: 0.9em;
+
+ .recent-posts {
+ margin-top: .8rem;
}
- .recent-empty {
- text-align: center;
- font-style: italic;
+
+ .recent-posts h2 {
+ margin-top: 1rem;
+ margin-bottom: 1rem;
+
}
</style>
<div class="recent-posts">
-
+ <h2>最近更新</h2>
{{ 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 ne (.Params.showMeta | default true) false }}
-<div class="post-meta">
-
- <div class="post-meta-item post-date">
- <time class="dt-published" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">
- {{ .Date.Format "January 02, 2006" }}
- </time>
- </div>
-
- <div class="post-meta-item post-category">
-
- {{ range .Params.categories }}
- {{ $url := printf "/categories/%s/" (. | urlize) }}
-•
- <a href="{{ $url }}" class="category-link">{{ . }}</a>
- {{ end }}
- </div>
-</div>
-{{ end }}
-
-
-
-
-
-
-
- <!-- <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 }}
+ <ul class="recent-list">
+ {{ range $recent }}
+ <li>
+ <span class="recent-date">{{ .Date.Format "2006-01-02" }}</span>
+ <a href="{{ .RelPermalink }}" class="recent-title">{{ .Title }}</a>
+ </li>
+ {{ end }}
+ </ul>
{{ else }}
<div class="recent-empty">暂无文章</div>
-
-
+ {{ end }}
</div>
-
-{{ end }}
-
-<!-- <div class="recent-posts"> -->
- <!-- {{ range $index, $page := $recent }} -->
- <!-- {{ end }} -->
- <!-- </div> -->
-
-<!-- <div class="recent-posts"> -->
- <!-- {{ if $recent }} {{ range $index, $page := $recent }} -->
- <!-- <div class="recent-posts-item"> -->
- <!-- <h2 class="recent-post-title post-title"> -->
- <!-- <a href="{{ .RelPermalink }}" class="item-link">{{ .Title }}</a> -->
- <!-- </h2> -->
- <!-- <div class="summary">{{ .Summary }}</div> -->
-
- <!-- {{ partial "post_meta.html" . }} -->
-
- <!-- {{ if not (eq (add $index 1) (len $recent)) }} {{ end }} {{ end }} {{ else }} -->
- <!-- <div class="recent-empty">暂无文章</div> -->
- <!-- {{ end }} -->
- <!-- </div> -->