Last active
March 27, 2019 19:14
-
-
Save varyen/c266fa349b47fa43ac4ad0831d8d6021 to your computer and use it in GitHub Desktop.
Vue component: prevent childs from indexing by crawlers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default { | |
name: 'NoIndex', | |
functional: true, | |
props: { | |
tag: { | |
type: String, | |
default: 'div', | |
}, | |
}, | |
render(h, {children, props}) { | |
const comment1 = h(''); | |
comment1.text = 'googleoff: all'; | |
const comment2 = h(''); | |
comment2.text = 'noindex'; | |
const comment3 = h(''); | |
comment3.text = '/noindex'; | |
const comment4 = h(''); | |
comment4.text = 'googleon: all'; | |
return h(props.tag, { | |
class: ['robots-noindex'], | |
}, [comment1, comment2, ...children, comment3, comment4]); | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment