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

Best practice for translate keywords ( react helmet ) & alt image description #181

Open
bastienallain opened this issue Apr 29, 2021 · 1 comment

Comments

@bastienallain
Copy link

bastienallain commented Apr 29, 2021

Hello i am looking for the best practice ( speed and code quality ) how to add a translation of React-helmet keywords.
And also how to translate properly the alt image description.
I turn around but i get too many error or flag :)
Should be useful on the seo template by default.

Any idea?
Best regards,

@MichaelLambrechts
Copy link

I don't know if it's the best practice but i did it like this:

For SEO:

with useIntl() and FormattedMessage :

const intl = useIntl();
...

<Seo title={ `${intl.formatMessage({ id: "contactSeo", })} `}
description={`${intl.formatMessage({ id: "contactDesc", })}`}
lang={intl.locale}
/>

For alt images:

<StaticImage
alt={intl.formatMessage({ id: "altImage" })}
/>

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