I am trying to render the meta tags on the server-side. so i can see this output on share link like this:
I tried React-Helmet but it's only rendering on load.
My Controller
public function home()
{
return view('home');
}
Blade:
<div class="post-list" id="booksList"></div>
React Module:
import React from "react";
import {Helmet} from "react-helmet";
export default function MetaTags(props) {
const { title , metas } = props
return (
<div className="application">
<Helmet>
<meta charSet="utf-8" />
<title>{ title ?? '' }-NicelyLogic</title>
<meta name="robots" content="index, follow" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="language" content="English" />
<meta name="title" content={title ?? ''+'-NicelyLogic'} />
<meta name="robots" content="index, follow" />
{
metas.map(meta => {
return (<meta name={meta.name} content={meta.content} />)
})
}
</Helmet>
</div>
)
}
It's working 100% correct when we load the site on browser that's mean it's only rendering metas on user side. I want to render the site on server side. So it become user friendly.