Closed m3andros closed 5 years ago
From this link https://vuepress.vuejs.org/guide/basic-config.html#app-level-enhancements
You can create file .vuepress/enhanceApp.js
with code like this:
export default ({
Vue, // the version of Vue being used in the VuePress app
options, // the options for the root Vue instance
router, // the router instance for the app
siteData // site metadata
}) => {
// ...apply enhancements to the app
// ...install additional plugin here
}
Thanks for the assistance @mazipan. I've gotten it to work, except I am now getting this error:
Failed to load resource: the server responded with a status of 400 ()
Not sure what the error means, since the Adsense ad isn't loading. Only a hollow white space is displaying. I've added the following to "test" the ad: data-adtest="on"
- but no cigar.
Any help you can provide would be most helpful!
Thank you.
Hmmm, white space is not always because this plugin not working. Sometimes it because your Adsense not work properly.
Just inspect element and make sure you can found this kind of element:
<ins data-ad-client="ca-pub-XXXXXXX" data-ad-slot="XXXXXX" data-ad-test="" data-ad-format="auto" class="adsbygoogle" data-adsbygoogle-status="done" style="display: block; height: 90px;">
....any child here
</ins>
I didn't get error info, only render <Adsense data-ad-client="ca-pub-xxx" data-ad-slot="xxx123"></Adsense>
in the page. My enhanceApp.js below:
export default ({
Vue, // the version of Vue being used in the VuePress app
options, // the options for the root Vue instance
router, // the router instance for the app
siteData // site metadata
}) => {
// ...apply enhancements to the app
Vue.use(require('vue-script2'))
Vue.use(require('vue-google-adsense/dist/Adsense.min.js'))
// Vue.use(require('vue-google-adsense/dist/InArticleAdsense.min.js'))
// Vue.use(require('vue-google-adsense/dist/InFeedAdsense.min.js'))
}
@m3andros Hi man. Could you share a demo code for showing how it works? Thank you in advance!
Is there a way to implement Adsense for VuePress, please?