Skip to content

Commit

Permalink
fix: noindex + nofollow override (#1062)
Browse files Browse the repository at this point in the history
  • Loading branch information
edoardolincetto authored Apr 1, 2023
1 parent aca05ca commit f2a5f7f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/meta/__tests__/buildTags.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -945,8 +945,8 @@ it('correctly read noindex & nofollow false', () => {
'meta[content="noindex,nofollow"]',
);

expect(Array.from(indexfollow).length).toBe(0);
expect(Array.from(noindexnofollow).length).toBe(1);
expect(Array.from(indexfollow).length).toBe(1);
expect(Array.from(noindexnofollow).length).toBe(0);
});

it('correctly read all robots props', () => {
Expand Down
13 changes: 7 additions & 6 deletions src/meta/buildTags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,14 @@ const buildTags = (config: BuildTagsParams) => {
}

const noindex =
config.noindex ||
defaults.noindex ||
config.dangerouslySetAllPagesToNoIndex;
config.noindex === undefined
? defaults.noindex || config.dangerouslySetAllPagesToNoIndex
: config.noindex;

const nofollow =
config.nofollow ||
defaults.nofollow ||
config.dangerouslySetAllPagesToNoFollow;
config.nofollow === undefined
? defaults.nofollow || config.dangerouslySetAllPagesToNoFollow
: config.nofollow;

let robotsParams = '';
if (config.robotsProps) {
Expand Down
2 changes: 1 addition & 1 deletion src/meta/nextSEO.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { WithHead } from './withHead';
export const NextSeo = ({
title,
themeColor,
noindex = false,
noindex,
nofollow,
robotsProps,
description,
Expand Down

0 comments on commit f2a5f7f

Please sign in to comment.