diff options
| author | Eltrac <hi@guhub.cn> | 2025-10-30 18:45:58 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-10-30 18:45:58 +0800 |
| commit | 568fb376c1cdac5d7fabbea17c2cae09f14b63d2 (patch) | |
| tree | eb2d34912b09e735fdcb919f4ab976053cf4007b | |
| parent | 3b01037abeb50abe8373375c39f36c406dc46341 (diff) | |
| parent | 25d8c5a8aada7eba865a0332599c0704254a42c7 (diff) | |
Merge branch 'master' of https://github.com/BigCoke233/geek-death-project
Former-commit-id: fe52d97fa87aca7996802744f330a7a2a40dc62a
| -rw-r--r-- | layouts/_partials/components/logo.html | 2 | ||||
| -rw-r--r-- | layouts/_partials/home/home-nav-item.html | 24 | ||||
| -rw-r--r-- | layouts/_partials/home/home-nav.html | 56 | ||||
| -rw-r--r-- | layouts/_partials/home/latest-posts.html | 27 | ||||
| -rw-r--r-- | layouts/_partials/scripts/libra-js.html | 6 |
5 files changed, 55 insertions, 60 deletions
diff --git a/layouts/_partials/components/logo.html b/layouts/_partials/components/logo.html index 63f500c5..e44fc9e9 100644 --- a/layouts/_partials/components/logo.html +++ b/layouts/_partials/components/logo.html @@ -1,4 +1,4 @@ -{{ $default := "https://image.guhub.cn/uPic/2025/05/header.png" }} +{{ $default := "https://image.guhub.cn/uPic/2025/05/header.png!w160" }} {{ $link := .link | default "" }} {{ $src := .src | default $default }} {{ $class := .class | default "" }} diff --git a/layouts/_partials/home/home-nav-item.html b/layouts/_partials/home/home-nav-item.html index 639e9762..71eb8883 100644 --- a/layouts/_partials/home/home-nav-item.html +++ b/layouts/_partials/home/home-nav-item.html @@ -2,16 +2,14 @@ {{ $link := .link }} {{ $text := .text }} -<div class="flex-shrink-0 flex-grow-0"> - <a href="{{ .Site.LanguagePrefix }}/{{ $link }}" - class="texl-base md:text-lg relative px-2 py-1 - hover:no-underline - {{ if $active }}font-extrabold{{ end }}" - > - {{ if $active }} - <div class="absolute -z-1 top-0 left-0 w-full h-full rounded bg-blockBg" - style="view-transition-name: home-nav-item;"></div> - {{ end }} - {{ $text }} - </a> -</div> +<a href="{{ .Site.LanguagePrefix }}/{{ $link }}" + class="texl-base md:text-lg relative px-2 py-1 + hover:no-underline + {{ if $active }}font-extrabold{{ end }}" +> + {{ if $active }} + <div class="absolute -z-1 top-0 left-0 w-full h-full rounded bg-blockBg" + style="view-transition-name: home-nav-item;"></div> + {{ end }} + {{ $text }} +</a> diff --git a/layouts/_partials/home/home-nav.html b/layouts/_partials/home/home-nav.html index e967b222..fd637ff9 100644 --- a/layouts/_partials/home/home-nav.html +++ b/layouts/_partials/home/home-nav.html @@ -1,35 +1,31 @@ {{ if eq .Site.Language.Lang "zh" }} -<div id="home-nav"> - <nav class="relative w-full ps-0 flex list-none gap-1 - text-size-sm md:text-size-base"> +<nav id="home-nav" class="relative w-full ps-0 flex list-none gap-1 + text-size-sm md:text-size-base"> + {{ partial "home/home-nav-item" (dict + "text" (T "postNav.latest") + "link" "" + "active" (eq "/" $.Page.RelPermalink) + ) }} + {{ if eq .Site.Language.Lang "zh" }} {{ partial "home/home-nav-item" (dict - "text" (T "postNav.latest") - "link" "" - "active" (eq "/" $.Page.RelPermalink) + "text" (T "postNav.featured") + "link" "featured" + "active" (eq "/featured/" $.Page.RelPermalink) ) }} - {{ if eq .Site.Language.Lang "zh" }} - {{ partial "home/home-nav-item" (dict - "text" (T "postNav.featured") - "link" "featured" - "active" (eq "/featured/" $.Page.RelPermalink) - ) }} - {{ partial "home/home-nav-item" (dict - "text" (T "postNav.categories") - "link" "categories" - "active" (or - (strings.HasPrefix $.Page.RelPermalink "/categories/") - (strings.HasPrefix $.Page.RelPermalink "/tags/")) - ) }} - {{ end }} + {{ partial "home/home-nav-item" (dict + "text" (T "postNav.categories") + "link" "categories" + "active" (or + (strings.HasPrefix $.Page.RelPermalink "/categories/") + (strings.HasPrefix $.Page.RelPermalink "/tags/")) + ) }} + {{ end }} - <li class="absolute right-0 dark:invert"> - <a href="{{ .Site.LanguagePrefix }}/stats" - data-tooltip="{{ T "statsTooltip" }}" - class="block opacity-50 transition-opacity duration-300 hover:opacity-100 - {{ if eq "/stats/" $.Page.RelPermalink }} opacity-100 font-bolder{{ end }}"> - <img src="/img/graph.svg" class="opacity-50 h-8 w-8" alt="Cthulu-style monster with an eye." /> - </a> - <li> - </nav> -</div> + <a href="{{ .Site.LanguagePrefix }}/stats" + class="absolute right-0 dark:invert + block opacity-50 transition-opacity duration-300 hover:opacity-100 + {{ if eq "/stats/" $.Page.RelPermalink }} opacity-100 font-bolder{{ end }}"> + <img src="/img/graph.svg" class="opacity-50 h-8 w-8" alt="Cthulu-style monster with an eye." /> + </a> +</nav> {{ end }} diff --git a/layouts/_partials/home/latest-posts.html b/layouts/_partials/home/latest-posts.html index cf80ece6..2a0beccd 100644 --- a/layouts/_partials/home/latest-posts.html +++ b/layouts/_partials/home/latest-posts.html @@ -1,16 +1,15 @@ <!-- Latest Posts --> -<section class="pagefind-exclude"> - <div class="flex flex-col my-4"> - {{ $firstPost := true }} <!-- 初始化标记 --> - {{ range first 12 (where site.RegularPages "Type" "in" site.Params.mainSections) }} - {{ partial "items/post" (dict - "ctx" . - "showSummary" $firstPost - ) }} - {{ $firstPost = false }} - {{ end }} - </div> - <a href="/posts" class="small-button"> - {{ T "moreLinks.posts" }} → - </a> +<section class="pagefind-exclude flex flex-col my-4"> + {{ $firstPost := true }} + {{ range first 5 (where site.RegularPages "Type" "in" site.Params.mainSections) }} + {{ partial "items/post" (dict + "ctx" . + "showSummary" $firstPost + ) }} + {{ $firstPost = false }} + {{ end }} </section> + +<a href="/posts" class="small-button"> + {{ T "moreLinks.posts" }} → +</a> diff --git a/layouts/_partials/scripts/libra-js.html b/layouts/_partials/scripts/libra-js.html index 0eea3d07..95e121ed 100644 --- a/layouts/_partials/scripts/libra-js.html +++ b/layouts/_partials/scripts/libra-js.html @@ -1,4 +1,6 @@ <script type="module"> - import LightBox from '/js/libra.min.js'; - const lightbox = new LightBox({ offset: { x: -8 ,y: -80 } }); +document.addEventListener('DOMContentLoaded', async () => { + const { default: LightBox } = await import('/js/libra.min.js'); + const lightbox = new LightBox({ offset: { x: -8, y: -80 } }); +}); </script> |
