我目前在Angular应用的SEO优化方面遇到问题。我有一个主要组件,其中包含指向“报告”页面的大量链接,如下所示报告/测试1,报告/测试2,报告/测试3,...此时路由如下所示:
const routes: Routes = [
{ path: '', component: Page1Component },
{ path: 'page1', component: Page1Component },
{ path: 'report/:name', component: ReportComponent }
];
因此,根据报告的名称,我在该页面上显示了不同的内容(报告)。而且我需要为每个显示的报告分别设置一组元标记和标题。所有可能的报告名称都是已知的,所以我的想法是为每个报告创建一条路由,像这样]
const routes: Routes = [ { path: '', component: Page1Component }, { path: 'page1', component: Page1Component }, { path: 'report/test1', component: ReportComponent }, { path: 'report/test2', component: ReportComponent }, { path: 'report/test3', component: ReportComponent } ];
然后在组件内部,根据路线显示不同的meta标签,但是我不确定是否会正确解释它。我已经为该应用程序使用了服务器端渲染。有谁知道它是否可以以其他方式完成,或者这种方法行得通?我不确定我的方向是否正确。谢谢!
我目前在Angular应用的SEO优化方面遇到问题。我有一个主要组件,其中有许多指向“报告”页面的链接,看起来像这个报告/测试1,报告/测试2,报告/测试3,... ...
此解决方案的问题: