markdown to jsx , SEO
Unanswered
atikYassine posted this in #help-forum
Hey guys , I created a blog using Markdown to jsx package and dynamic a route to get the mdx file content .
My question is , will my blog posts be indexed on google using that way ? or no .
Here's my dynamic route code :
My question is , will my blog posts be indexed on google using that way ? or no .
Here's my dynamic route code :
import React from 'react'
import fs from 'fs';
import Markdown from 'markdown-to-jsx';
import matter from 'gray-matter';
import getPostsMetaData from '../../../components/blog/GetPostMetadata';
import Head from 'next/head';
const getPostContent = (slug: string) => {
const folder = 'posts/';
const files = `${folder}${slug}.mdx`;
const content = fs.readFileSync(files, 'utf8');
const matterResult = matter(content);
return matterResult
}
export const generateStaticParams = async () => {
const posts = getPostsMetaData();
return posts.map((post) => ({
slug: post.slug
})
)
}
const Page = (props: any) => {
const slug = props.params.slug;
const post = getPostContent(slug);
return (
<div>
<Head>
<title>{post.data.title}</title>
<meta name='title'
content={post.data.title} />
<meta name="description" content={post.data.description} />
<meta name="keywords" content={post.data.keywords} />
</Head>
<div className='prose w-[100%] min-w-full px-5 sm:px-20 py-2 sm:py-5'>
<h1>
{post.data.title}
</h1>
<Markdown>{post.content}</Markdown>
</div>
</div>
)
}
export default Page