From f6eddcb3a58df3d11d5cd7feeff573a1084345b0 Mon Sep 17 00:00:00 2001 From: Shotaro Nakamura Date: Wed, 7 Feb 2024 11:19:23 +0000 Subject: [PATCH] =?UTF-8?q?feat(seo):=20robots.txt=E3=81=A8noindex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/robots.txt | 2 ++ src/layouts/Base.astro | 5 +++++ src/pages/app/notes/[noteid].astro | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 public/robots.txt diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 00000000..f6e6d1d4 --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,2 @@ +User-Agent: * +Allow: / diff --git a/src/layouts/Base.astro b/src/layouts/Base.astro index d685b9ef..3f50155c 100644 --- a/src/layouts/Base.astro +++ b/src/layouts/Base.astro @@ -8,6 +8,8 @@ export interface Props { useViewTransitions?: boolean ogpType?: 'website' | 'article' + + noIndex?: boolean } const userAgent = (Astro.request.headers.get('User-Agent') ?? '').toLowerCase() @@ -37,6 +39,9 @@ nomalizedUrl.protocol = 'https://' + { + Astro.props.noIndex && + } { // ViewTransitions diff --git a/src/pages/app/notes/[noteid].astro b/src/pages/app/notes/[noteid].astro index 3a34b9c8..5cbcfa39 100644 --- a/src/pages/app/notes/[noteid].astro +++ b/src/pages/app/notes/[noteid].astro @@ -15,7 +15,7 @@ if ((/^local\-.+$/).test(noteId)) { } } --- - +