Skip to content

Commit

Permalink
robots props - adding noodp and noydir
Browse files Browse the repository at this point in the history
robots props - adding noodp and noydir
  • Loading branch information
Damian Chodkiewicz committed Jan 30, 2025
1 parent 2bc2791 commit 302db4b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,8 @@ const Page = () => (
maxSnippet: -1,
maxImagePreview: 'none',
maxVideoPreview: -1,
noodp: true,
noydir: true,
}}
/>
<p>Additional robots props in Next-SEO!!</p>
Expand All @@ -503,7 +505,7 @@ const Page = () => (
export default Page;

/*
<meta name="robots" content="index,follow,nosnippet,max-snippet:-1,max-image-preview:none,noarchive,noimageindex,max-video-preview:-1,notranslate">
<meta name="robots" content="index,follow,nosnippet,max-snippet:-1,max-image-preview:none,noarchive,noimageindex,max-video-preview:-1,notranslate,noodp,noydir">
*/
```

Expand All @@ -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)

Expand Down
4 changes: 3 additions & 1 deletion src/meta/buildTags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ const buildTags = (config: BuildTagsParams) => {
noimageindex,
notranslate,
unavailableAfter,
noodp,
noydir,
} = config.robotsProps;

robotsParams = `${nosnippet ? ',nosnippet' : ''}${
Expand All @@ -153,7 +155,7 @@ const buildTags = (config: BuildTagsParams) => {
noimageindex ? ',noimageindex' : ''
}${maxVideoPreview ? `,max-video-preview:${maxVideoPreview}` : ''}${
notranslate ? ',notranslate' : ''
}`;
}${noodp ? ',noodp' : ''}${noydir ? ',noydir' : ''}`;
}

if (config.norobots) {
Expand Down
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,8 @@ export interface AdditionalRobotsProps {
unavailableAfter?: string;
noimageindex?: boolean;
notranslate?: boolean;
noodp?: boolean;
noydir?: boolean;
}

export interface NextSeoProps {
Expand Down

0 comments on commit 302db4b

Please sign in to comment.