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

How do I append a value to the title? #693

Open
kjoedion opened this issue Nov 14, 2022 · 3 comments
Open

How do I append a value to the title? #693

kjoedion opened this issue Nov 14, 2022 · 3 comments

Comments

@kjoedion
Copy link

kjoedion commented Nov 14, 2022

Is there a way to append an additional value to all page titles?

For example, something like:

${helmet.title.append(` - ${process.env.APP_NAME}`).toString()}
@ajayunnikuttan
Copy link

you can use titleTemplate

<Helmet
defaultTitle={process.env.APP_NAME}
titleTemplate={%s - ${process.env.APP_NAME} }
/>

output

<title>some Title - MyAwesomeWebsite.com</title> https://www.npmjs.com/package/react-helmet

@kjoedion
Copy link
Author

Yeah but I'd have to put that in every component right?

Was wondering if there was a global way to apply it to all my components.

@ajayunnikuttan
Copy link

you don't need to put in every component. you can add it on the root index.js file or routes.js file

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