0

I have noindex enabled in my entire Vue app using { name: 'robots', content: 'noindex' }, but I want to enable it just for some pages. I am using Vue 2 and webpack 4.46.0.

Is there a way to disable noindex for specific pages or should I overwrite it with some custom meta tags or maybe do something else? Thanks in advance.

3
  • Well are you setting those values in a script? Instead of 'noindex' you could call a function returning 'index,follow' or 'noindex,nofollow', depending on the current router path. AFAIK navigation using # is probably not counted as a different page so Google will not reconsider the robot meta tag when navigating using vue router. Commented Mar 13, 2023 at 14:35
  • @PeterKrebs , thank you for the quick response. Yes, I am using a function in my nuxt.config.js file and my meta look like this: meta: [...meta({ title, description, homepage })] and my meta function is defined in another file. However, I am not sure if I will be able to access the route in this nuxt config file. Commented Mar 13, 2023 at 14:46
  • Ah yes the headers in this case will be fixed to whatever you set it to. You could use native JavaScript to change the meta robots tag depending on the current route. I doubt Google will observe the change if the page is not reloaded, though. Commented Mar 13, 2023 at 15:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.