Make blog list cards fully clickable
This commit is contained in:
@@ -7,3 +7,6 @@ public/
|
|||||||
# OS files
|
# OS files
|
||||||
.DS_Store
|
.DS_Store
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
|
||||||
|
# Local build check output
|
||||||
|
tmpcheck/
|
||||||
|
|||||||
+17
-7
@@ -186,30 +186,40 @@ figcaption.post-caption {
|
|||||||
}
|
}
|
||||||
.footer-roadmap { padding: 1rem 0; }
|
.footer-roadmap { padding: 1rem 0; }
|
||||||
|
|
||||||
/* ===== Homepage post list: entire card is clickable ===== */
|
/* ===== Post lists (home + /blog): whole card is one clickable link ===== */
|
||||||
#post-list .home-post-item {
|
#post-list .post-card {
|
||||||
display: block;
|
display: block;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
border-radius: 0.5rem;
|
border-radius: 0.5rem;
|
||||||
padding: 0.75rem 1rem;
|
padding: 0.75rem 1rem;
|
||||||
margin: 0 -1rem 0.5rem;
|
margin: 0 -1rem;
|
||||||
transition: background-color 0.15s ease;
|
transition: background-color 0.15s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
#post-list .home-post-item h3 {
|
#post-list .post-card h3 {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#post-list .home-post-item:hover {
|
#post-list .post-card:hover {
|
||||||
background-color: rgba(0, 0, 0, 0.04);
|
background-color: rgba(0, 0, 0, 0.04);
|
||||||
}
|
}
|
||||||
|
|
||||||
html.dark #post-list .home-post-item:hover {
|
html.dark #post-list .post-card:hover {
|
||||||
background-color: rgba(255, 255, 255, 0.06);
|
background-color: rgba(255, 255, 255, 0.06);
|
||||||
}
|
}
|
||||||
|
|
||||||
#post-list .home-post-item:focus-visible {
|
#post-list .post-card:focus-visible {
|
||||||
outline: 2px solid var(--hx-color-primary-500, currentColor);
|
outline: 2px solid var(--hx-color-primary-500, currentColor);
|
||||||
outline-offset: 2px;
|
outline-offset: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Home: spacing between cards */
|
||||||
|
#post-list .home-post-item {
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* /blog list: keep the original item rhythm (旧 hx:mb-10 + h3 mt-8 的视觉间距) */
|
||||||
|
#post-list .blog-post-item {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|||||||
+12
-20
@@ -21,34 +21,26 @@
|
|||||||
|
|
||||||
<div id="post-list">
|
<div id="post-list">
|
||||||
{{- range $i, $p := $pages }}
|
{{- range $i, $p := $pages }}
|
||||||
|
{{- /* 整块卡片即一个链接:框内任意位置点击都进入文章;
|
||||||
|
标签放在卡片外面,保证标签本身仍是可点链接 */}}
|
||||||
<div
|
<div
|
||||||
class="hx:mb-10 blog-post-item{{ if ge $i $batch }} hx:hidden{{ end }}"
|
class="blog-post-item{{ if ge $i $batch }} hx:hidden{{ end }}"
|
||||||
data-index="{{ $i }}"
|
data-index="{{ $i }}"
|
||||||
>
|
>
|
||||||
<h3>
|
<a href="{{ $p.RelPermalink }}" class="post-card">
|
||||||
<a
|
<h3 class="hx:text-2xl">{{ $p.Title }}</h3>
|
||||||
style="color: inherit; text-decoration: none"
|
<p class="hx:opacity-50 hx:text-sm hx:mt-1 hx:leading-7">
|
||||||
class="hx:block hx:font-semibold hx:mt-8 hx:text-2xl"
|
{{ partial "utils/format-date" $p.Date }}
|
||||||
href="{{ $p.RelPermalink }}"
|
</p>
|
||||||
>{{ $p.Title }}</a
|
<p class="hx:opacity-80 hx:mt-2 hx:leading-7">
|
||||||
>
|
{{- partial "utils/page-description" $p -}}
|
||||||
</h3>
|
</p>
|
||||||
<p class="hx:opacity-50 hx:text-sm hx:mt-1 hx:leading-7">
|
</a>
|
||||||
{{ partial "utils/format-date" $p.Date }}
|
|
||||||
</p>
|
|
||||||
{{ if site.Params.blog.list.displayTags }}
|
{{ if site.Params.blog.list.displayTags }}
|
||||||
<div class="hx:text-sm hx:leading-7">
|
<div class="hx:text-sm hx:leading-7">
|
||||||
{{ partial "tags.html" (dict "context" $p) }}
|
{{ partial "tags.html" (dict "context" $p) }}
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<a
|
|
||||||
href="{{ $p.RelPermalink }}"
|
|
||||||
style="color: inherit; text-decoration: none"
|
|
||||||
>
|
|
||||||
<p class="hx:opacity-80 hx:mt-2 hx:leading-7">
|
|
||||||
{{- partial "utils/page-description" $p -}}
|
|
||||||
</p>
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
{{- /* 整块卡片即一个链接:框内任意位置点击都进入文章 */}}
|
{{- /* 整块卡片即一个链接:框内任意位置点击都进入文章 */}}
|
||||||
<a
|
<a
|
||||||
href="{{ $p.RelPermalink }}"
|
href="{{ $p.RelPermalink }}"
|
||||||
class="home-post-item{{ if ge $i $batch }} hx:hidden{{ end }}"
|
class="home-post-item post-card{{ if ge $i $batch }} hx:hidden{{ end }}"
|
||||||
data-index="{{ $i }}"
|
data-index="{{ $i }}"
|
||||||
>
|
>
|
||||||
<h3 class="hx:text-xl">{{ $p.Title }}</h3>
|
<h3 class="hx:text-xl">{{ $p.Title }}</h3>
|
||||||
|
|||||||
Reference in New Issue
Block a user