help meta data
Unanswered
Polar bear posted this in #help-forum
Polar bearOP
How do I get the url from the server side? I have tried many ways
I know there's a way to get the parameters /123/123
or some way to arrow the meta data on the client side
I know there's a way to get the parameters /123/123
or some way to arrow the meta data on the client side
24 Replies
@Ray what are you trying to achieve?
Polar bearOP
This logo is received from an external API
I want to put a description and everything else too
sorry, I don't get it. Are you trying to change the favicon?
Polar bearOP
yes
Server-side or client-side?
@ncls. Server-side or client-side?
Polar bearOP
There are two solutions, one and I can change the meta data on the client side, the other and I can get the current domain of the website on the server side
If I wrote it wrong, I'm sorry and the translator
@Polar bear There are two solutions, one and I can change the meta data on the client side, the other and I can get the current domain of the website on the server side
why do you need to know the current domain to set the favicon?
Polar bearOP
complex
depending on the url the site settings change
@ncls. Try this: https://github.com/vercel/next.js/issues/46618#issuecomment-1450416633
Polar bearOP
I want to get the hostname, it looks like that and to get the pathname
You can get both
Polar bearOP
ok
req.hostname would be the hostname/domain@ncls. `req.hostname` would be the hostname/domain
Polar bearOP
thanks
@ncls. `req.hostname` would be the hostname/domain
Polar bearOP
async function getData() {
const res = await fetch(`/api/url`, {
method: 'GET'
});
console.log(res)
if (!res.ok) {
throw new Error('Failed to fetch data');
}
return res.json();
}
export default async function Test() {
const data = await getData()
console.log('aaa', data)
return (
<h1>aloooo</h1>
)
}
tldr: just don't
Polar bearOP
I need help changing the meta tags in "use client"