Repository: garmeeh/next-seo (js)

Issue:
next-seo dangerouslySetAllPagesToNoFollow and dangerouslySetAllPagesToNoIndex does not allow override 
According to the documentation for next-seo plugin, we should be able to override [dangerouslySetAllPagesToNoFollow](https://github.com/garmeeh/next-seo#dangerouslysetallpagestonofollow) and [dangerouslySetAllPagesToNoIndex](https://github.com/garmeeh/next-seo#dangerouslysetallpagestonoindex) defined in \<DefaultSeo\> component on a page level via \<NextSeo\> component:

"You can still override this at a page level if you have a use case to index a page. This can be done by setting noindex: false."


I have added dangerously set options in default seo in _app.tsx:
```
<DefaultSeo
                  dangerouslySetAllPagesToNoIndex={true}
                  dangerouslySetAllPagesToNoFollow={true}
  />
```

and set nofollow/noindex to false for the pages I need indexed:

```
   <NextSeo
                nofollow={false}
                noindex={false}
            />
```

yet I'm getting noindex/nofollow meta tags in rendered pages which have nofollow/noindex set to false:

```
<meta name="robots" content="noindex,nofollow">
<meta name="googlebot" content="noindex,nofollow">
```

when the expected tags should be:
```
<meta name="robots" content="index,follow">
<meta name="googlebot" content="index,follow">
```

Please let me know how this could be resolved, any help appreciated 



Pull request description:
fix: noindex + nofollow override
## Description of Change(s):

Fixes #967

---

To help get PR's merged faster, the following is required:

- [x] Updated the documentation
- [x] Unit/Cypress test covering all cases

Please link to relevant Google Docs or schema.org docs for what you are adding so we can review.

Please have a read of the Contributing Guide for full details.

https://github.com/garmeeh/next-seo/blob/master/CONTRIBUTING.md


Patch:
diff --git a/src/meta/buildTags.tsx b/src/meta/buildTags.tsx
index c7a63a1..0c395a2 100644
--- a/src/meta/buildTags.tsx
+++ b/src/meta/buildTags.tsx
@@ -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) {
diff --git a/src/meta/nextSEO.tsx b/src/meta/nextSEO.tsx
index 2802786..006c403 100644
--- a/src/meta/nextSEO.tsx
+++ b/src/meta/nextSEO.tsx
@@ -6,7 +6,7 @@ import { WithHead } from './withHead';
 export const NextSeo = ({
   title,
   themeColor,
-  noindex = false,
+  noindex,
   nofollow,
   robotsProps,
   description,


Test patch:
diff --git a/src/meta/__tests__/buildTags.spec.tsx b/src/meta/__tests__/buildTags.spec.tsx
index 4922896..8f046a0 100644
--- a/src/meta/__tests__/buildTags.spec.tsx
+++ b/src/meta/__tests__/buildTags.spec.tsx
@@ -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', () => {