Reputation: 718
I am using ServeStaticModule to send back a index.html file. I want to add custom meta tags for facebook preview. I tried doing it on the client side but that doesn't work as Facebook takes the old title and description rather than the new one that has been modified on the client side. The client side is in React.
Any suggestion on how to do it?
Upvotes: 2
Views: 1406
Reputation: 24681
You have to use template engine - read more
template example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>App</title>
</head>
<body>
{{ message }}
</body>
</html>
app.controller.ts
import { Get, Controller, Render } from '@nestjs/common';
@Controller()
export class AppController {
@Get()
@Render('index')
root() {
return { message: 'Hello world!' };
}
}
Upvotes: 1