Skip to content

Commit

Permalink
feat: add ads
Browse files Browse the repository at this point in the history
  • Loading branch information
lcxfs1991 committed Feb 24, 2024
1 parent 13228ff commit 239a04a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 12 additions & 0 deletions src/components/Ads/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import ExecutionEnvironment from "@docusaurus/ExecutionEnvironment";



export default function Ads() {
if (ExecutionEnvironment.canUseDOM) {
const UnionAds = require('union-ad-react');
return <UnionAds id="u6954954" />;
}

return null;
}
6 changes: 3 additions & 3 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import Layout from '@theme/Layout';
import HomepageFeatures from '@site/src/components/HomepageFeatures';
import Heading from '@theme/Heading';
// import UnionAd from 'union-ad-react';

import styles from './index.module.css';
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';
import Ads from '../components/Ads';

function HomepageHeader() {
const {siteConfig} = useDocusaurusContext();
Expand Down Expand Up @@ -46,7 +46,7 @@ export default function Home(): JSX.Element {
2020年-2022年回归腾讯文档,单人文字品类技术负责人
&nbsp;<a href="https://weibo.com/leehkfs/" target='_blank'>微博</a> | <a href="https://www.zhihu.com/people/leehey/" target='_blank'>知乎</a> | <a href="https://github.com/lcxfs1991" target='_blank'>Github</a>
</blockquote>
{/* <UnionAd id="u6954954"></UnionAd> */}
<Ads />
</div>
</main>
</Layout>
Expand Down

0 comments on commit 239a04a

Please sign in to comment.