我有一个关于 Angular SEO 的小问题。我已经在每个 .ts 文件的构造函数中设置了这样的元标记;
//To set the page title
this.titleServ.setTitle("PAGE TITLE")
//To set the meta description
this.meta.addTags([
{name: "description", content: "PAGE TITLE HERE"},
{name: "keywords", content: "SOME KEYWORDS HERE"}
])
问题是,我在 2,5 周前进行了这些更改,但是在使用页面描述进行搜索时,我仍然无法在 Google 上看到我的网站(我可以在搜索网站名称时看到它)。我可能在这里做错了什么?顺便说一句,我无法使用 angular Universal 构建我的应用程序,但据我所知,Google 不需要 angular Universal 来查找描述和关键字。
我还应该做些什么才能让我的网站在 Google 上可见?
最佳答案
我遇到了同样的问题,经过大量研究,我发现 Google 在 SPA 中查找 URL 时遇到问题。
你应该建立一个 sitemap.xml
文件并将其提供给 Google Search Console。
示例站点地图.xml:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://www.example.com/</loc>
<lastmod>2005-01-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
</urlset>
关于javascript - Angular SEO,如何正确设置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65562905/