Add support to overwrite only the parts of the root meta function #9523
Replies: 1 comment
-
In v1, the MetaFunction used an object and automatically merged the meta keys, this way if you only overwrote the title only that changed, this had issues where some meta keys could be added multiple times (e.g. In Remix v2 this was changed to use an array, your MetaFunction now receives the parent route array of meta tags, this way you could grab the list, map it and change only the title if you want. There's also |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
After starting working with remix in projects I fell in love with it. It's a great framework to build modern web apps.
While I´ve worked on a big project with remix, I´ve found out by an accident that the root meta function was overwritten, after I exported on an route a meta function, where I´ve just added a new title. My first thought was that only the title where overwritten in the root file and not the robots object.
root.jsx
export function meta() { return [ { title: "Candidate.dk" }, { robots: "none" }, ]; }
route.jsx
export function meta() { return [ { title: "Candidate.dk — Candidates for Digital Internships and Jobs" }, ]; }
It would be an nice idea if the root meta function and maybe also the links function where global settings for a site, while meta and link function on routes would be children for the root meta and links function, and only replace in the root the objects that where defined in the route meta function.
So in the example above only the title would be changed in the root and the robots object wouldn´t be touched or overwritten.
Beta Was this translation helpful? Give feedback.
All reactions