Open ashwinkhode opened 2 years ago
Try this code:
<NextSeo description={undefined} />
Try this code:
<NextSeo description={undefined} />
@AntoineKM Tried! not working :(
Yeah, i'm running into the same issue. Not even an empty string works.
Any workaround?
Guys, for me it was another component, somewhere down the tree, in the same view, that was overriding the "description" with empty string description=""
maybe that's your case too
@GrzegorzDerdak Do you mean that you were able to "unset" a description for a single page when a default is used globally?
Looks like the only way to "fix" this is by using a space. Would be nice if you can override the default with undefined
or null
to unset a property
Same issue for me. Is there any workaround?
I'm setting default SEO at the _app.tsx level and want to remove some tags on my 404 page.
Here's my workaround:
import type { AppProps } from "next/app";
import Script from "next/script";
import { DefaultSeo } from "next-seo";
import SEO_CONFIG from "@/lib/seo/next-seo.config";
import Layout from "@/components/layout";
export default function App({ Component, pageProps }: AppProps) {
const is404 = Component.name === "Custom404";
return (
<>
{ !is404 && <DefaultSeo {...SEO_CONFIG} /> }
<Layout>
<Component {...pageProps} />
</Layout>
</>
);
}
Then I use NextSeo tag (import { NextSeo } from "next-seo";
) in my Custom404
component.
import { PageConfig } from "next";
import { NextSeo } from "next-seo";
import { SITE_NAME } from "@/lib/constants";
import { ADDITIONAL_META_TAGS, FAVICON_TAGS } from "@/lib/seo/next-seo.config";
export const config: PageConfig = {
unstable_runtimeJS: false,
};
export default function Custom404() {
const title = `Page not found - ${ SITE_NAME }`;
return (
<>
<NextSeo
title={ title }
noindex={ true }
additionalMetaTags={ ADDITIONAL_META_TAGS }
additionalLinkTags={ FAVICON_TAGS }
openGraph= {{
locale: "en_US",
title: title,
siteName: SITE_NAME,
}}
/>
<h1>404 - Page Not Found</h1>
);
};
Describe the bug I want to set empty description but I am not able to override the default seo's description. Can I do it or is it just not possible? This is more of a question rather than a bug.
Expected behavior Empty description should be set if passed empty string
""
in NextSeo even if default seo is present