Metadata Title Template + generateMetadata
Answered
Capelin posted this in #help-forum
CapelinOP
Hey guys, I have a title template defined in
Then I use
Problem: when I navigate to homepage the title is
Thank you
layout.tsx as follows.export const metadata: Metadata = {
title: {
template: 'Foo | %s',
default: 'Foo | Bar',
},
description: 'Foo Bar',
}Then I use
generateMetadata in page.tsx located at the same level as layout.tsx (homepage). The function returns the following. ...
const metadata: Metadata = {
title: 'Home',
description: 'Description of homepage',
}
return metadata
}Problem: when I navigate to homepage the title is
Home instead of Foo | Home. How can I achieve the latter?Thank you
2 Replies
@joulev https://github.com/vercel/next.js/issues/46859
CapelinOP
Understood, thanks.