I got a site that built with Next.js framework. As to optimise the SEO, I added Unique <Meta/>
tags in <Head/>
component from Next/Head
on each pages (index.tsx, titles/[title].tsx). However, when testing with crawling site like BrowseSEO, the Meta tags specified on each pages was not readable. Title also been displayed wrong.
Here is link to the site page in browseSEO: Eating Animal Page
Here is the snippet from pages/titles/[title].tsx
file
const Title: NextPage<{ content: Content; }> = ({
content,
}) => {
const {title, titlePath, desc} = content
return (
<>
<Head>
<link rel="canonical" href={`https://www.iwonder.com${titlePath}`} />
<title>{`Watch ${title} Streaming Online | iwonder`}</title>
<meta key="description" name="description" content={desc} />
</Head>
...
</>
)
}
export const getServerSideProps = async ({ req }: GetServerSidePropsContext) => {
const { url = '' } = req
const thePath = uri.parse(url).pathname
const id = thePath.substring(thePath.lastIndexOf('/')
const { content } = await getSingleTitle(id) //fetch for content data
return { props: { content } }
}
export default Title
It would be if anyone could help to highlight what is wrong. Thanks!
_document.tsx
? If yes, remove it since it will lead to unexpected behavior. (Custom Document Caveats) If you want a default title for all pages, do it in_app.tsx
. – Huntlee_app.tsx
already – Floriculture