Skip to content

Commit

Permalink
feat(seo): robots.txtとnoindex
Browse files Browse the repository at this point in the history
  • Loading branch information
nakasyou committed Feb 7, 2024
1 parent b9a6748 commit f6eddcb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
User-Agent: *
Allow: /
5 changes: 5 additions & 0 deletions src/layouts/Base.astro
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export interface Props {
useViewTransitions?: boolean
ogpType?: 'website' | 'article'
noIndex?: boolean
}
const userAgent = (Astro.request.headers.get('User-Agent') ?? '').toLowerCase()
Expand Down Expand Up @@ -37,6 +39,9 @@ nomalizedUrl.protocol = 'https://'
<meta property="og:description" content={Astro.props.description}>
<meta property="og:site_name" content="Nanoha">
<meta property="og:type" content={Astro.props.ogpType ?? 'website'}>
{
Astro.props.noIndex && <meta name="robots" content="noindex" />
}

{
// ViewTransitions
Expand Down
2 changes: 1 addition & 1 deletion src/pages/app/notes/[noteid].astro
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if ((/^local\-.+$/).test(noteId)) {
}
}
---
<Base title="" description="nanohanote app" bodyClass="bg-background text-on-background">
<Base title="" description="nanohanote app" noIndex={true} bodyClass="bg-background text-on-background">
<NanohaNoteApp client:load noteLoadType={noteLoadType} />
</Base>
<style is:global>
Expand Down

0 comments on commit f6eddcb

Please sign in to comment.