https://github.com/john60676/vuepress-plugin-google-adsense2
✨Google AdSense plugin for VuePress 2, automatically adds Google Ad to your VuePress site. ✨ VuePress 2 的 Google AdSense 插件, 自动帮你在你的 VuePress 站点上添加谷歌广告
https://github.com/john60676/vuepress-plugin-google-adsense2
google google-ads google-adsense vuepress vuepress-plugin vuepress2 vuepress2-plugin
Last synced: 7 months ago
JSON representation
✨Google AdSense plugin for VuePress 2, automatically adds Google Ad to your VuePress site. ✨ VuePress 2 的 Google AdSense 插件, 自动帮你在你的 VuePress 站点上添加谷歌广告
- Host: GitHub
- URL: https://github.com/john60676/vuepress-plugin-google-adsense2
- Owner: John60676
- License: mit
- Created: 2021-01-19T09:42:19.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-10-16T07:11:40.000Z (almost 2 years ago)
- Last Synced: 2025-03-01T00:23:04.948Z (7 months ago)
- Topics: google, google-ads, google-adsense, vuepress, vuepress-plugin, vuepress2, vuepress2-plugin
- Language: TypeScript
- Homepage:
- Size: 31.3 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README-zh_CN.md
- License: LICENSE
Awesome Lists containing this project
README
# vuepress-plugin-google-adsense2
[English](./README.md) | 简体中文
> 注意: 这个插件是提供给 **VuePress 2** 版本的
VuePress 2 的 [Google adsense](https://www.google.com/adsense) 插件, 自动帮你在你的 VuePress 站点上添加[谷歌广告](https://support.google.com/adsense/answer/9261306)。
[](https://www.npmjs.com/package/vuepress-plugin-google-adsense2) [](https://github.com/John60676/vuepress-plugin-google-adsense2/blob/master/LICENSE)
## 安装
```sh
yarn add -D vuepress-plugin-google-adsense2
# 或者
npm install -D vuepress-plugin-google-adsense2
```## 用法
```js
import googleAdSensePlugin from 'vuepress-plugin-google-adsense2';module.exports = {
plugins: [
googleAdSensePlugin({
id: 'ca-pub-xxxxxxx',
}),
],
};
```更多插件的使用方式,请参考 [VuePress Plugins](https://vuepress2.netlify.app/reference/plugin-api.html#plugins)
## 选项
### id
- 类型: `string`
- 详情:
在 AdSense 提供给你的代码块中,找到 `'data-ad-client'` 一词。 `id` 应该以`'ca-pub-'`开头。 你可以按照[此处](https://support.google.com/adsense/answer/7584263?hl=zh_CN)的说明查找 AdSense 代码。
亦或者你可以使用 **发布商 ID** 并在前面加上 `'ca-'` 字符串,来组合成 `id`。你可以按照[此处](https://support.google.com/adsense/answer/105516?hl=zh-hans)的说明查找 AdSense **发布商 ID**。