How do I add link to the head using metadata
Answered
Manx posted this in #help-forum
ManxOP
I want to implement PWA and I need to add some links, tho it seems that Nextjs only allows head elements to be added through the exported metadata.
I wanna add these:
I wanna add these:
<link rel="manifest" href="/resources/manifest.json" />
<link rel="apple-touch-icon" href="/media/icons/logo.svg" />
<link rel="apple-mobile-webapp-status-bar" content="#444" />Answered by joulev
you can simply add them to the page like normal react components. they will be automatically hoisted to <head>
3 Replies
@Manx I want to implement PWA and I need to add some links, tho it seems that Nextjs only allows head elements to be added through the exported metadata.
I wanna add these:
jsx
<link rel="manifest" href="/resources/manifest.json" />
<link rel="apple-touch-icon" href="/media/icons/logo.svg" />
<link rel="apple-mobile-webapp-status-bar" content="#444" />
you can simply add them to the page like normal react components. they will be automatically hoisted to <head>
Answer
@joulev you can simply add them to the page like normal react components. they will be automatically hoisted to <head>
ManxOP
Hmm, I was doing some thing wrong, now it works.
TY.