summaryrefslogtreecommitdiffstats
path: root/layouts
diff options
context:
space:
mode:
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/post_meta.html20
-rw-r--r--layouts/partials/style.html15
-rw-r--r--layouts/shortcodes/recent-posts.html140
3 files changed, 140 insertions, 35 deletions
diff --git a/layouts/partials/post_meta.html b/layouts/partials/post_meta.html
index 741efd2..1c180c3 100644
--- a/layouts/partials/post_meta.html
+++ b/layouts/partials/post_meta.html
@@ -1,33 +1,24 @@
{{ if ne (.Params.showMeta | default true) false }}
<div class="post-meta">
- <div class="post-meta-item post-author">
- {{ with .Params.author | default "Verdant" }}
- <p>
- <svg t="1768726817979" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4715" width="200" height="200"><path d="M858.5 763.6c-18.9-44.8-46.1-85-80.6-119.5-34.5-34.5-74.7-61.6-119.5-80.6-0.4-0.2-0.8-0.3-1.2-0.5C719.5 518 760 444.7 760 362c0-137-111-248-248-248S264 225 264 362c0 82.7 40.5 156 102.8 201.1-0.4 0.2-0.8 0.3-1.2 0.5-44.8 18.9-85 46-119.5 80.6-34.5 34.5-61.6 74.7-80.6 119.5C146.9 807.5 137 854 136 901.8c-0.1 4.5 3.5 8.2 8 8.2h60c4.4 0 7.9-3.5 8-7.8 2-77.2 33-149.5 87.8-204.3 56.7-56.7 132-87.9 212.2-87.9s155.5 31.2 212.2 87.9C779 752.7 810 825 812 902.2c0.1 4.4 3.6 7.8 8 7.8h60c4.5 0 8.1-3.7 8-8.2-1-47.8-10.9-94.3-29.5-138.2zM512 534c-45.9 0-89.1-17.9-121.6-50.4S340 407.9 340 362c0-45.9 17.9-89.1 50.4-121.6S466.1 190 512 190s89.1 17.9 121.6 50.4S684 316.1 684 362c0 45.9-17.9 89.1-50.4 121.6S557.9 534 512 534z" p-id="4716"></path></svg>
- {{ . }}
- </p>
- {{ end }}
- </div>
-
<div class="post-meta-item post-date">
- <svg t="1768727464189" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5925" width="200" height="200"><path d="M341.333333 170.666667h341.333334V85.333333h85.333333v85.333334h42.666667a85.333333 85.333333 0 0 1 85.333333 85.333333v597.333333a85.333333 85.333333 0 0 1-85.333333 85.333334H213.333333a85.333333 85.333333 0 0 1-85.333333-85.333334V256a85.333333 85.333333 0 0 1 85.333333-85.333333h42.666667V85.333333h85.333333v85.333334zM213.333333 341.333333v512h597.333334V341.333333H213.333333z m85.333334 128h85.333333v85.333334H298.666667v-85.333334z m170.666666 0h85.333334v85.333334h-85.333334v-85.333334z m170.666667 0h85.333333v85.333334h-85.333333v-85.333334z m0 170.666667h85.333333v85.333333h-85.333333v-85.333333z m-170.666667 0h85.333334v85.333333h-85.333334v-85.333333z m-170.666666 0h85.333333v85.333333H298.666667v-85.333333z" fill="#000000" p-id="5926"></path></svg>
<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">
- <svg t="1768727819011" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7095" width="200" height="200"><path d="M85.312 153.6v716.8h853.376V288H471.36L364.416 153.6h-279.04zM0 64h404.288L511.36 198.4H1024V960H0V64z" fill="#262626" p-id="7096"></path></svg>
+
{{ range .Params.categories }}
{{ $url := printf "/categories/%s/" (. | urlize) }}
+•
<a href="{{ $url }}" class="category-link">{{ . }}</a>
{{ end }}
</div>
+ {{ if eq .Kind "page" }}
<div class="post-meta-item post-tag">
- <svg t="1768727897449" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8070" width="200" height="200"><path d="M512 910.208L910.208 512 480.832 82.624l-378.816 24.448-19.776 373.376L512 910.208zM0 512L25.472 31.36 512 0l512 512-512 512-512-512z m293.376-128.96a85.952 85.952 0 1 0 0-171.904 85.952 85.952 0 0 0 0 171.904z" fill="#262626" p-id="8071"></path></svg>
+ #
{{ $tags := .GetTerms "tags" }}
{{ $len := len $tags }}
{{ range $index, $tag := $tags }}
@@ -35,5 +26,8 @@
{{ if lt (add $index 1) $len }}, {{ end }}
{{ end }}
</div>
+ {{ end }}
</div>
{{ end }}
+
+
diff --git a/layouts/partials/style.html b/layouts/partials/style.html
index 33ba584..ec4dae2 100644
--- a/layouts/partials/style.html
+++ b/layouts/partials/style.html
@@ -19,8 +19,7 @@
--upvoted-color: #fa8072;
--caption-text-color: #666;
--toc-text-color: #e5e5e5;
- --toc-hover-color
-: e5e5e5;
+ --toc-hover-color: e5e5e5;
--music-bg-hover-light: #e5e5e5;
--music-bg-light: rgba(229, 229, 229, 0.5);
--music-text-secondary: #666;
@@ -73,6 +72,10 @@ h1, h2 {
color: var(--body-text-color)
}
+.post-meta-item a {
+ font-size: .85rem;
+}
+
body {
@@ -280,9 +283,8 @@ ul.blog-posts li span.grouped {
}
.post-meta-item {
- margin-right: 0.8em;
+ margin-right: 0.3rem;
display: inline-block;
- font-size: var(--font-size-secondary);
}
.post-meta-item svg {
@@ -296,7 +298,6 @@ ul.blog-posts li span.grouped {
}
.post-tag a {
- font-size: var(--font-size-secondary) !important;
}
img {
@@ -647,6 +648,10 @@ ul li:has(input) {
text-decoration: none;
}
+h3.recent-post-title a {
+color: var(--body-text-color);
+}
+
a:hover {
text-decoration: underline;
}
diff --git a/layouts/shortcodes/recent-posts.html b/layouts/shortcodes/recent-posts.html
index ea6ed2b..a666a4c 100644
--- a/layouts/shortcodes/recent-posts.html
+++ b/layouts/shortcodes/recent-posts.html
@@ -1,30 +1,136 @@
{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} {{
-$recent := first 5 $pages.ByDate.Reverse }}
+$recent := first 6 $pages.ByDate.Reverse }}
<style>
-.item-link {
-word-wrap: break-word;
- white-space: normal;
- }
-</style>
+ .item-link {
+ word-wrap: break-word;
+ white-space: normal;
+ }
+ .recent-list {
+ margin: 0;
+ }
+ .post-meta {
+ margin-bottom: 5px;
+ }
+ .recent-item {
+ position: relative;
+ margin-bottom: 8px;
+ flex-shrink: 0;
+ }
+ .split {
+ margin: 0;
+ padding: 0;
+ display: inline;
+ }
+ .recent-posts-item {
+ margin-top: 0;
+ margin-bottom: 35px;
+ }
+ .recent-post-title {
+ margin-top: 2px;
+ margin-bottom: -10px;
-<!-- <div class="recent-posts"> -->
-<!-- {{ range $index, $page := $recent }} -->
-<!-- {{ end }} -->
-<!-- </div> -->
+ }
+ @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; /* 取消省略号 */
+ }
+ }
+ .category-link {
+ font-size: 0.9em;
+ }
+ .recent-empty {
+ text-align: center;
+ font-style: italic;
+ }
+</style>
<div class="recent-posts">
- {{ if $recent }} {{ range $index, $page := $recent }}
+
+ {{ if $recent }}
+ {{ range $index, $page := $recent }}
<div class="recent-posts-item">
- <h2 class="recent-post-title post-title">
+ <h3 class="recent-post-title">
<a href="{{ .RelPermalink }}" class="item-link">{{ .Title }}</a>
- </h2>
- <div class="summary">{{ .Summary }}</div>
+ </h3>
- {{ partial "post_meta.html" . }}
+{{ if ne (.Params.showMeta | default true) false }}
+<div class="post-meta">
- {{ if not (eq (add $index 1) (len $recent)) }} {{ end }} {{ end }} {{ else }}
- <div class="recent-empty">暂无文章</div>
+ <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 }}
+ {{ else }}
+ <div class="recent-empty">暂无文章</div>
+
+
</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> -->