vuejs / vuepress

📝 Minimalistic Vue-powered static site generator
https://vuepress.vuejs.org
MIT License
22.48k stars 4.78k forks source link

Plugins: Google Adsense Integration #784

Open m3andros opened 6 years ago

m3andros commented 6 years ago

Feature request

What problem does this feature solve?

Similar to how we can declare the google analytics ID in config.js with the ga type, is there an opportunity to do it for Google Adsense?

What does the proposed API look like?

publisherId: string

And VuePress will automatically generate and register your AdSense publisher ID along with the script dependencies, i.e. <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

How should this be implemented in your opinion?

From a Vue component, say, we can declare it as such:

<adsense
  ad-client="ca-pub-xxxxxxxxxxxxxxxx"
  ad-slot="XXXXXXXX">
</adsense>

Are you willing to work on this yourself?**

Work has already been done for Vue - but not for VuePress.

ulivz commented 6 years ago

This should be done as a plugin. you can create a PR to next directly.