Follow noindex, nofollow

bpeab
3
bpeab
commented 3 months ago

Hello,

I wonder if there's any way so that I can filter the routes and remove the ones where the robots meta tags is set with noindex,nofollow. I tried with the filter property but apparently the routes are not providing the meta object and therefore I don't see anyway I could do that.

Thanks for the help !

1
NicoPennec
2.1k
NicoPennec
commented 3 months ago

Currently there is no easy way to access to head.meta of a route from the sitemap module.

It's just an idea, but with the sitemap filter you can access to the routes array.
Each static route have a component property equal to the path of its <page>.vue component, so you can parse its file to find if it contains a "noindex" value, for example.

  {
    name: 'index',
    path: '/',
    component: '/Users/test/nuxt-project/pages/index.vue',
    chunkName: 'pages/index',
    url: '/'
  },
0
bpeab
3
bpeab
commented 2 months ago

Thanks for your response @NicoPennec. I read your answer a little bit to late but find a way to do what I wanted. I actually created a file containing all the routes and defines the noindex per route that I then filtered.

0
Informations
Question โ€ข Unresolved
#c107 - Created 3 months ago