@harrison.goodwin
To disable the noindex meta tag for specific pages in Vue.js, you can make use of the Vue Router and modify the meta tags dynamically.
Here's an example of how you can achieve this:
1
|
npm install vue-meta --save |
1 2 3 4 |
import Vue from 'vue'; import VueMeta from 'vue-meta'; Vue.use(VueMeta); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
import Vue from 'vue'; import Router from 'vue-router'; Vue.use(Router); const router = new Router({ routes: [ { path: '/noindex-page', name: 'NoIndexPage', component: NoIndexPage, meta: { noindex: true, // Add this meta field to indicate noindex }, }, // Other routes... ], }); router.beforeEach((to, from, next) => { // Update the meta tags based on the value of the "noindex" field if (to.meta.noindex) { VueMeta().metaInfo = { meta: [ { name: 'robots', content: 'noindex', }, ], }; } else { VueMeta().metaInfo = {}; // Reset the meta tags for other pages } next(); }); export default router; |
1 2 3 |
export default { name: 'NoIndexPage', }; |
Now, on your NoIndexPage, the noindex meta tag will be disabled while other pages will still have the noindex tag present.
Remember to adapt the code based on your specific project setup and routing needs.