为什么我的 Nuxt/vue 页面被 robots.txt 屏蔽了?

问题描述

这不是关于 SEO 最佳实践的问题,而是关于如何在 VUE 中正确设置 config.js 和脚本部分的问题

我已经使用 Vue/Nuxt 构建了我的网站,之前我在公园里用 angular 散步的东西现在导致了错误。

我的总体问题是我不确定我是否正确构建了我的脚本部分,因为我的页面没有被 Google 索引。在我的 nuxt.config.js 文件中,我构建了我的站点地图、robot.txt 和一些通用元标记。对于每个页面,我都在其脚本部分构建了动态元标记。

Google Search Console 给出了 3 种类型的错误。

  1. 有些页面被我的 robots.txt 屏蔽了
  2. 据说有些页面是重复的 rel-canonical
  3. 在检查我的网站时,它无法在 URL 末尾输入“/”的情况下查找页面。使用 Screaming Frog SEO 工具时也会出现这种情况。

我的假设是我缺少某种形式的重定向,该重定向使爬虫索引页面以“/”结尾,因为这些页面在 Search Console 中可以正常编入索引?

Nuxt.config.js 文件(部分,未显示所有内容)

    head: {
    title: 'NorthArc',meta: [
      { charset: 'utf-8' },{ name: 'viewport',content: 'width=device-width,initial-scale=1' },{ name: 'language',content: 'da_DK' },{ name: 'robots',content: 'index,follow' },{ name: 'og:type',content: 'website' },],link: [
      { rel: 'icon',type: 'image/x-icon',href: '/favicon.ico' },]
  },sitemap: {
    path: '/sitemap.xml',hostname: 'https://northarc.dk/',routes: [
      {
        url: '/',changefreq: 'monthly',priority: 1,},{
        url: '/team/',{
        url: '/groen-planlaegning/',{
        url: '/strategisk-samarbejde/',{
        url: '/blog/',{
        url: '/blog/er-ruteplanlaegning-svaert/',{
        url: '/blog/automatisk-ruteplanlaegning/',{
        url: '/faq/',{
        url: '/contact/',{
        url: '/policies/',}
    ]
  },robots: {
    UserAgent: 'Googlebot',Disallow: ['/roi','/pricing'],Sitemap: 'https://northarc.dk/sitemap.xml',

来自据说被阻止的页面的脚本部分 bt robots.txt 并复制了 rel-canonical。

    <script>
export default {
  name: 'home',head() {
    return {
      title: 'test',meta: [
        { 
        hid: 'description',name: 'description',content: 'test',{ hid: 'robots',name: 'robots',{hid: 'og-title',property: 'og:title',content: 'Fjern spildtid på vejen og minimere antal kørte kilometer'},{hid: 'og-url',property: 'og:url',content: 'https://northarc.dk/groen-planlaegning'},{hid: 'og-description',property: 'og:description',content: 'test'},{hid: 'og-image',property: 'og:image',content: '/Applications/Northarc_landing/assets/Preview_sløret.jpg'},link: [
      { 
      rel: 'canonical',href: 'https://northarc.dk/groen-planlaegning/' 
      }
    ] 
    }
  }
};
</script>

注意事项:(变更日志)

  1. 我尝试在我的站点地图中的所有站点 URL 以及上面显示的页面示例的 rel-canonical 中添加一个“/”。
  2. 我已尝试将 robots.txt 的用户更改为 googlebot 以禁用两个页面。在用户被设置为“*”之前,它仍然阻止了一些页面。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)