Next.js Discord

Discord Forum

External css link

Answered
Barbary Lion posted this in #help-forum
Open in Discord
Barbary LionOP
Hello,
Version: Next 14.1.2 app router
i want to use an external css link server side that it uses a variable in pathing.
e.g. /ecss/${store.id}/footer,aux.css?v=${store.updated_at}

generateMetadata doesnt provide styling/links.
any solutions?
Thanks in advance!
Answered by joulev
no need to be inside the root layout. can be anywhere. react will automatically hoist it up to <head> – just ensure you add a precedence attribute
View full answer

5 Replies

Just render the <link> tag like any ordinary jsx tag. With a precedence attribute though: https://react.dev/reference/react-dom/components/link#special-rendering-behavior
Barbary LionOP
inside the root layout i should add a head tag? Isn't this a bad practice?
no need to be inside the root layout. can be anywhere. react will automatically hoist it up to <head> – just ensure you add a precedence attribute
Answer
Barbary LionOP
will try it thank you!!
Barbary LionOP
(it is solved i cant find the tag answered in dropdown, please do mark it as solved)