From 302db4b731c0f17ed7ec417568679c04e2aa2ca8 Mon Sep 17 00:00:00 2001 From: Damian Chodkiewicz Date: Thu, 30 Jan 2025 11:52:25 +0100 Subject: [PATCH] robots props - adding noodp and noydir robots props - adding noodp and noydir --- README.md | 6 +++++- src/meta/buildTags.tsx | 4 +++- src/types.ts | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6c2d38f3..3be968a8 100644 --- a/README.md +++ b/README.md @@ -494,6 +494,8 @@ const Page = () => ( maxSnippet: -1, maxImagePreview: 'none', maxVideoPreview: -1, + noodp: true, + noydir: true, }} />

Additional robots props in Next-SEO!!

@@ -503,7 +505,7 @@ const Page = () => ( export default Page; /* - + */ ``` @@ -519,6 +521,8 @@ export default Page; | `notranslate` | boolean | Do not offer translation of this page in search results. | | `noimageindex` | boolean | Do not index images on this page. | | `unavailable_after` | string | Do not show this page in search results after the specified date/time. The date/time must be specified in a widely adopted format including, but not limited to RFC 822, RFC 850, and ISO 8601. | +| `noodp` | boolean | Do not use Open Directory Project descriptions in search snippets. | +| `noydir` | boolean | Do not use Yahoo Directory descriptions in search snippets. | For more reference about the `X-Robots-Tag` visit [Google Search Central - Control Crawling and Indexing](https://developers.google.com/search/reference/robots_meta_tag?hl=en-GB#directives) diff --git a/src/meta/buildTags.tsx b/src/meta/buildTags.tsx index 32e07b61..61e6e0ac 100644 --- a/src/meta/buildTags.tsx +++ b/src/meta/buildTags.tsx @@ -143,6 +143,8 @@ const buildTags = (config: BuildTagsParams) => { noimageindex, notranslate, unavailableAfter, + noodp, + noydir, } = config.robotsProps; robotsParams = `${nosnippet ? ',nosnippet' : ''}${ @@ -153,7 +155,7 @@ const buildTags = (config: BuildTagsParams) => { noimageindex ? ',noimageindex' : '' }${maxVideoPreview ? `,max-video-preview:${maxVideoPreview}` : ''}${ notranslate ? ',notranslate' : '' - }`; + }${noodp ? ',noodp' : ''}${noydir ? ',noydir' : ''}`; } if (config.norobots) { diff --git a/src/types.ts b/src/types.ts index ac9ddd0a..4a8af4e7 100644 --- a/src/types.ts +++ b/src/types.ts @@ -466,6 +466,8 @@ export interface AdditionalRobotsProps { unavailableAfter?: string; noimageindex?: boolean; notranslate?: boolean; + noodp?: boolean; + noydir?: boolean; } export interface NextSeoProps {