我使用prerender.io渲染角6页使用无头铬。问题是渲染器不呈现路由器链路,链接信息丢失。
这是特别有问题的,因为渲染的目的是SEO。
例如,带有routerLink="previewLink“的按钮将呈现给没有路由器链接的按钮。
下面是一个活生生的例子
呈现的页面没有链接
https://prerender.io/raw-html?url=https%3A%2F%2Fwww.fiveabook.com%2Fbooks&adaptiveType=desktop
在“预览”按钮中没有href和没有路由器链接:
<button _ngcontent-c12="" color="accent" mat-button="" tabindex="0" class="mat-button mat-accent ng-star-inserted"><span class="mat-button-wrapper">带路由器链接的角页
https://www.fiveabook.com/books
按钮具有动态生成的路由器链接。
发布于 2019-04-01 08:26:01
Html按钮没有href属性。如果您想要生成超链接按钮,只需使用锚元素。
<a mat-button [routerLink]="...">
Link
</a>发布于 2019-03-31 18:50:46
如果我直接在我的Mac上的Chrome浏览器中加载https://www.fiveabook.com/books并查找该按钮,那么我也没有看到一个href:

所以看起来我们呈现的页面就像普通的Chrome浏览器所呈现的一样。
https://stackoverflow.com/questions/55433647
复制相似问题