From a7fea79d98c6fecd2765bc174971d5a218d2aac7 Mon Sep 17 00:00:00 2001 From: grassblock Date: Thu, 22 May 2025 21:43:35 +0800 Subject: [PATCH 1/3] feat: implement no-client-JavaScript support for back-to-top and search (WIP) --- src/components/BackToTop.astro | 7 ++++--- src/components/Search.astro | 14 +++++++++++++- src/config.ts | 9 ++++++++- src/layouts/Layout.astro | 5 ++++- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/src/components/BackToTop.astro b/src/components/BackToTop.astro index 59c0c27..3fe2679 100644 --- a/src/components/BackToTop.astro +++ b/src/components/BackToTop.astro @@ -1,7 +1,8 @@ --- - +import {siteConfig} from "../config"; +const noscript = siteConfig.noClientJavaScript --- - +{noscript ? : \ No newline at end of file +} \ No newline at end of file diff --git a/src/components/Search.astro b/src/components/Search.astro index b115350..61027d7 100644 --- a/src/components/Search.astro +++ b/src/components/Search.astro @@ -1,5 +1,17 @@ --- +import {siteConfig} from "../config"; +const noscript = siteConfig.noClientJavaScript --- +{noscript ? +
+
+ + + +
+ +
+ :
search @@ -92,7 +104,7 @@ document.getElementById('search-results').innerHTML = '

Loading search index...

'; } }); - +}