Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it able to change the meta tags dynamically? #30

Open
flutistar opened this issue Jan 7, 2021 · 2 comments
Open

Is it able to change the meta tags dynamically? #30

flutistar opened this issue Jan 7, 2021 · 2 comments

Comments

@flutistar
Copy link

Hello @oayres
Hope you are well.
I have a react project that needs to be sever-side rendering or pre-rendering.
I'd like to change the <title></title> and <meta name="description> dynamically according to the route.
I am using Redux.

Well, is it possible to change the title and meta tags dynamically if I install this package?
TBH, I've attempted several server-side rendering/pre-rendering libraries and still rendering static meta tags.

Many thanks.

@oayres
Copy link
Owner

oayres commented Jan 7, 2021

Hi @developer7132
I recommend using React Helmet to achieve this. You can see their server usage (with helmet.renderStatic()) in their docs.

To achieve this in react-ssr, you'd need to leverage the Html config property and use your own HTML 'skeleton'. However, the default template included inside react-ssr does do a safe require of Helmet and includes the rendering of meta tags and title tags, so you may not need to override the template if this is all you'd like.

It's worth me stressing here that react-ssr only has some skeletal support for a small subset of users. I can update the library with some refreshers and improvements if you decide to go ahead with it.

Irrespective of this, react-helmet is probably the way to go whether you use this package, another one, or prerender. My advice is to pre-render for most people because it simplifies life and your app only has to worry about rendering in one "enviornment" (a browser).

Hope this helps and thanks for dropping by the package! I'll keep this open for a short period incase you have any follow-up.

Owen

@flutistar
Copy link
Author

flutistar commented Feb 7, 2021

Thank you for your advice!
I am already using Helmet. Helmet is working properly on browser but it's not working properly on Google Console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants