Change tab title to what page user is on
how do i change tab title to what page the user is on? for example "SaaS - Dasboard"
1 Reply
Hi @Sven. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To change the tab title dynamically based on the current page in a Wasp application, you have a few options:
Using the Root Component
The most flexible approach is to use Wasp's root component feature to set up a custom title management system:
1. First, set up a root component in your
main.wasp
file:
2. Then implement your Root component with title management:
This approach uses the root component to wrap your entire application and update the document title whenever the location changes. The root component is a perfect place for this kind of functionality as explained in the Client Config documentation.
Alternative: Page-specific Title Updates
You can also update the title directly in each page component:
This approach works well if you have a small number of pages and prefer to keep the title logic with each page component.
Choose the approach that best fits your application structure and complexity.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Sven, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?