Skip to content

Commit

Permalink
chore: 固定广告使用 pantip
Browse files Browse the repository at this point in the history
  • Loading branch information
youngjuning committed Jul 26, 2024
1 parent 39cce60 commit 482764d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .dumi/theme/layouts/DocLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ const DocLayout: FC = () => {
<Adsense
className="adsbygoogle"
style={{ display: "block" }}
data-ad-client="ca-pub-7029815294762181"
data-ad-slot="6412968057"
data-ad-client="ca-pub-4963807055498900" data-ad-host="ca-host-pub-1012064661720050"
data-override-format="true" data-page-url="https://pantip.com"
data-ad-format="auto"
data-full-width-responsive="true"
/>
Expand Down
26 changes: 14 additions & 12 deletions .dumi/theme/slots/Adsense/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@ import React, { useEffect } from 'react';

const Adsense: React.FC<any> = (props) => {
useEffect(() => {
// @ts-ignore
(window.adsbygoogle = window.adsbygoogle || []).push({})
}, [])
try {
// @ts-ignore
(adsbygoogle = window.adsbygoogle || []).push({});
} catch (error) {
console.info('谷歌广告被屏蔽了');
}
}, []);

return (
<>
<div style={{ width: "100%", margin: "16px 0"}}>
<center>
<ins {...props} />
</center>
</div>
</>
<div style={{ width: '100%', margin: '16px 0' }}>
<center>
<ins {...props} />
</center>
</div>
);
}
};

export default Adsense
export default Adsense;
5 changes: 3 additions & 2 deletions .dumi/theme/slots/Sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ const Sidebar: FC = () => {
<Adsense
className="adsbygoogle"
style={{display: "block" }}
data-ad-client="ca-pub-7029815294762181"
data-ad-slot="9225510179"
data-ad-client="ca-pub-4963807055498900" data-ad-host="ca-host-pub-1012064661720050"
data-override-format="true"
data-page-url="https://pantip.com"
data-ad-format="auto"
data-full-width-responsive="true"
/>
Expand Down

0 comments on commit 482764d

Please sign in to comment.