- Notifications
You must be signed in to change notification settings - Fork0
Docusaurus plugin for Google AdSense
License
NotificationsYou must be signed in to change notification settings
hhk7734/docusaurus-plugin-google-adsense
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This plugin is for Docusaurus v2 and v3.
yarn add docusaurus-plugin-google-adsense
Modifydocusaurus.config.ts
:
importtype{Config}from"@docusaurus/types";constconfig:Config={plugins:['docusaurus-plugin-google-adsense'],themeConfig:{googleAdsense:{dataAdClient:'ca-pub-xxxxxxxxxx',},},};exportdefaultconfig;
SwizzleDocItem/Content
yarn swizzle @docusaurus/theme-classic DocItem/Content --wrap
Modifysrc/theme/DocItem/Content/index.tsx
like this:
importReactfrom"react";importContentfrom"@theme-original/DocItem/Content";importtypeContentTypefrom"@theme/DocItem/Content";importtype{WrapperProps}from"@docusaurus/types";importAdSensefrom"react-adsense";typeProps=WrapperProps<typeofContentType>;exportdefaultfunctionContentWrapper(props:Props):JSX.Element{return(<><div><AdSense.Googleclient="ca-pub-xxxxxxxxxx"slot="yyyyyyyyyy"style={{display:"block"}}format="auto"responsive="true"/></div><br/><Content{...props}/><br/><div><AdSense.Googleclient="ca-pub-xxxxxxxxxx"slot="yyyyyyyyyy"style={{display:"block"}}format="auto"responsive="true"/></div></>);}
npm login
npm publish
About
Docusaurus plugin for Google AdSense
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.