Is it bad if I dynamically render the metadata url(metadataBase)?
Unanswered
Chartreux posted this in #help-forum
ChartreuxOP
Since my site's domain might change in the future, I wrote this code
Will that code cause any issues later on?
export const metadata: Metadata = {
metadataBase: new URL(process.env.NEXT_PUBLIC_SITE_URL || 'https://example.com'),
title: 'Your Page Title',
openGraph: {
title: 'Title',
url: '/page-path',
images: ['/image.png'],
},
};
Will that code cause any issues later on?
4 Replies
Why do you think it might cause problems later? Be more specific.
@Rapidement Why do you think it might cause problems later? Be more specific.
ChartreuxOP
I mean will that code actually work?
@Chartreux I mean will that code actually work?
When you dev locally you can inspect your page to see if you have the metadata 🙂
Look in the
<head>
part you should she <title>Your Page Title</title>
for example