Nextjs is not rendering dynamic meta tags with the data using serverSideProps

1.4k Views Asked by At

hello folks i need some help regarding SEO in nextjs i am trying it for like 2 weeks or so but unable to do so i am getting the data from the backend in serverSideProps it is successfully loading the page but the crawlers are unable to pick it up they don't show any thing. at First i wrote my component, that didn't worked

import React from 'react';
import Head from 'next/head';

const MetaPreviewComponent = ({url = "https://elementsdistro.com/", type = "website", title, summary, imageUrl}) => {
  return (
    <Head>
      <title>Social Media Preview</title>
      <meta property="og:url" content={url}/>
      <meta property="og:type" content={type}/>
      <meta property="og:title" content={title}/>
      <meta name="twitter:card" content={summary}/>
      <meta
        property="og:description"
        content="this is working properly, the description"
      />
      <meta property="og:image" content={imageUrl || 'https://www.example.com/images/placeholder.jpg'}/>
    </Head>
  );
};

export default MetaPreviewComponent;

now i am trying with the next-seo but same thing. attached screenshot is a page component living in the prodcuts/[product].js

any help would be highly highly appreciated, if you can even point me in the right direction I'll be very grateful to you.

enter image description here

0

There are 0 best solutions below