NextJS 网站首页。如何处理 rel=canonical?

huangapple go评论60阅读模式
英文:

NextJS website index page. How to approach rel=canonical?

问题

I have this website https://www.buscamusicos.net. Google has "/index" page indexed, and I accidentally added /index to the sitemap.xml, so now Google Search Console is telling me that /index is a duplicate of /, and that I haven't set a canonical URL.

For now I've removed /index from the sitemap.xml, but I'm dubious about how to actually proceed. Should I add it again and add this to my index.js file?

<Head>
    <link
        rel="canonical"
        href="https://www.buscamusicos.net/index"
        key="canonical"
    />
</Head>

Or should I just forget about it?

Another issue is that currently the index page title is shown as BuscaMúsicos: Inicio, instead of what I set (Inicio - BuscaMúsicos). I wonder if adding the above code would make Google show the title I want.

英文:

I have this website https://www.buscamusicos.net. Google has "/" page indexed, and I accidentally added /index to the sitemap.xml, so now Google Search Console is telling me that /index is a duplicate of /, and that I haven't set a canonical URL.

For now I've removed /index from the sitemap.xml, but I'm dubious about how to actually proceed. Should I add it again and add this to my index.js file?

&lt;Head&gt;
    &lt;link
        rel=&quot;canonical&quot;
        href=&quot;https://www.buscamusicos.net/index&quot;
        key=&quot;canonical&quot;
    /&gt;
&lt;/Head&gt;

Or should I just forget about it?

Another issue is that currently the index page title is shown as BuscaMúsicos: Inicio, instead of what I set (Inicio - BuscaMúsicos). I wonder if adding the above code would make Google show the title I want.

答案1

得分: 0

如果您已经从您的sitemap.xml中移除了/index,并且它在您的网站上没有其他链接,那么不需要担心,因为Googlebot将无法爬取它,它最终会从搜索结果中消失。

我建议您继续使用根目录(/)。您应该设置一个规范的URL,以指示搜索引擎/index页面的内容是根目录的重复内容。在这种情况下,代码应该如下所示:

<Head>
  <link rel="canonical" href="https://www.buscamusicos.net/" />
</Head>

另一个问题是,目前index页面的标题显示为BuscaMúsicos: Inicio,而不是我设置的Inicio - BuscaMúsicos。我想知道添加上述代码是否会使Google显示我想要的标题。

确保您的标题如下所示,并且一旦Google重新爬取和重新索引您的页面,它应该反映在搜索结果中。

<Head>
  <title>Inicio - BuscaMúsicos</title>
</Head>
英文:

If you have removed /index from your sitemap.xml and it is not linked anywhere else on your website, then there is no need to worry about it as Googlebot will not be able to crawl it and it will eventually drop out of the search results.

I would recommend you stick with the root directory (/). You should set up a canonical URL to indicate to search engines that the content on the /index page is duplicate content of the root directory. In this case the code should look like this:

&lt;Head&gt;
  &lt;link rel=&quot;canonical&quot; href=&quot;https://www.buscamusicos.net/&quot; /&gt;
&lt;/Head&gt;

> Another issue is that currently the index page title is shown as BuscaMúsicos: Inicio, instead of what I set (Inicio - BuscaMúsicos). I wonder if adding the above code would make Google show the title I want.

Make sure your title looks like this and should be reflected in the search results once Google recrawls and reindexes your page.

&lt;Head&gt;
  &lt;title&gt;Inicio - BuscaM&#250;sicos&lt;/title&gt;
&lt;/Head&gt;

huangapple
  • 本文由 发表于 2023年4月19日 16:30:36
  • 转载请务必保留本文链接:https://go.coder-hub.com/76052315.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定