Skip to content

Commit

Permalink
feat: add ability for noindex
Browse files Browse the repository at this point in the history
  • Loading branch information
WayneGoosen committed Sep 13, 2024
1 parent 201cb16 commit 436b0bd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/layouts/BaseLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import ProviderAnimations from '@/components/ProviderAnimations'
import TwSizeIndicator from '@/components/TwSizeIndicator'
import EditBlog from '@/components/editBlog'
import PlausibleAnalytics from '@/components/PlausibleAnalytics'
const { title, description, image, articleDate } = Astro.props
const { title, description, image, articleDate, isNoIndex = false } = Astro.props
---

<html lang='en' class='scroll-smooth'>
Expand All @@ -19,6 +19,7 @@ const { title, description, image, articleDate } = Astro.props
<link rel='sitemap' href='/sitemap-index.xml' />
<meta name='msvalidate.01' content='B773311CC89DD46884A05AF0D59BF25E' />
<meta name='google-site-verification' content='QgzbyFVx7jxbDQP2l9cOnb6pN0NyqxITFmemST5Ot9w' />
{isNoIndex && <meta name='robots' content='noindex' />}
</head>

<body class='bg-white text-stone-950 dark:bg-[#0a0910] dark:text-white'>
Expand Down Expand Up @@ -46,7 +47,6 @@ const { title, description, image, articleDate } = Astro.props
src='https://www.chatbase.co/embed.min.js'
chatbotId='kIjPNUQCBNQTNMUt1ldgG'
domain='www.chatbase.co'
defer
></script>
defer></script>
</body>
</html>
1 change: 1 addition & 0 deletions src/pages/category/[category]/[page].astro
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const posts = page.data
<BaseLayout
title={params.category}
description={`See all blog posts with the following category: ${params.category}/`}
isNoIndex={true}
>
<TitlePage title={unsluglifyNameCategory} />
<ListCategories activeCategory={params.category} />
Expand Down
6 changes: 5 additions & 1 deletion src/pages/tags/[...tag]/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ const { tag } = Astro.props
const posts = await getPostByTag(tag)
---

<BaseLayout title={tag} description={`See all blog posts with the following tag: ${tag}`}>
<BaseLayout
title={tag}
description={`See all blog posts with the following tag: ${tag}`}
isNoIndex={true}
>
<TitlePage title={tag} />
<ListPosts posts={posts} />
</BaseLayout>
1 change: 1 addition & 0 deletions src/pages/tags/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const tags = await getTags()
<BaseLayout
title='Tags'
description='See all available tags on the blog and be able to filter posts by them.'
isNoIndex={true}
>
<TitlePage title='Tags' />
<div class='flex justify-center flex-wrap gap-4'>
Expand Down

0 comments on commit 436b0bd

Please sign in to comment.