tangly1024 / NotionNext

使用 NextJS + Notion API 实现的,支持多种部署方案的静态博客,无需服务器、零门槛搭建网站,为Notion和所有创作者设计。 (A static blog built with NextJS and Notion API, supporting multiple deployment options. No server required, zero threshold to set up a website. Designed for Notion and all creators.)
https://tangly1024.com
MIT License
7.27k stars 10.15k forks source link

【更灵活的广告嵌入】在文章指定的段落嵌入广告,How add Adsense in Heo Theme. #1746

Closed Nexus-Gits closed 6 months ago

Nexus-Gits commented 8 months ago

Please tell me how add adsense code in heo site.

tangly1024 commented 8 months ago

Hello! Sure, I'd be happy to help you add AdSense to the Heo theme. There are two main methods to do this:

  1. Automatic Ads (Simpler):

    • Configure the ADSENSE_GOOGLE_ID in NotionNext.
    • Set up automatic ads, like banner and interstitial ads, in the Google AdSense backend.
    • Google AdSense will then automatically insert ads into your Heo site based on the configured settings.

    image

  2. Custom Ad Units (More Complex):

    • Create four types of ad units in Google AdSense.
    • Configure their unit IDs and the ADSENSE_GOOGLE_ID in NotionNext. (Refer to this link)

    image

  3. After the configuration, use the AdSlot component (AdSlot) in your Heo theme wherever you want to display ads.

    you can refer to the approach used in other themes, such as the Fukasawa theme. For instance, in the themes/fukasawa/index.js file, a similar method is employed:

  import { AdSlot } from '@/components/GoogleAdsense'

  const LayoutBase = ...{
                 {/*  Ad unit displayed here */}

                <div className='mt-2'>
                  <AdSlot type='native' />
                </div>
  }

This demonstrates how to integrate the AdSlot component in the Fukasawa theme. Feel free to adapt this example to add AdSense to your Heo theme. If you have any more questions or need further assistance, please let me know!

Nexus-Gits commented 8 months ago

How i set up, ads insert after every certain word later on every blog post.