fast icon indicating copy to clipboard operation
fast copied to clipboard

feat: add dynamic route titles in `FAST-Router`

Open KingOfTac opened this issue 3 years ago • 3 comments

🙋 Feature Request

A nice feature I think would be the ability to interpolate route parameters into the title.

🤔 Expected Behavior

The ability to do something like this:

{ path: 'products/{productName}', title: '{productName}' }

😯 Current Behavior

The above code would produce "{productName}" as the page title.

💁 Possible Solution

Since this is all happening in the route mapping, I think all that is required is to check if the childTitle contains a match for the route parameter and interpolate the value. Much like it already does for the path.

🔦 Context

A common pattern for things like products and blog posts is to set the page title to the title of the product or post in addition to some other text.

💻 Examples

Newegg product listing image

Post on Medium image

KingOfTac avatar Aug 26 '22 18:08 KingOfTac

I self-assigned this; however, I'd like to get other people's thoughts on the feature before starting on anything.

KingOfTac avatar Aug 26 '22 18:08 KingOfTac