File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ google_analytics: G-E2F9P3J8TQ # 실제 GA4 측정 ID로 교체 필요
1616# Google AdSense
1717adsense :
1818 client : ca-pub-4992764083187170
19- auto_ads : true
19+ auto_ads : false
2020 show_ads : true
2121
2222# Comments system
Original file line number Diff line number Diff line change 1+ {% if site.adsense.client and site.adsense.show_ads %}
2+ < div class ="ad-container ">
3+ < ins class ="adsbygoogle "
4+ style ="display:block "
5+ data-ad-client ="{{ site.adsense.client }} "
6+ data-ad-slot ="2396306733 "
7+ data-ad-format ="auto "
8+ data-full-width-responsive ="true "> </ ins >
9+ < script >
10+ ( adsbygoogle = window . adsbygoogle || [ ] ) . push ( { } ) ;
11+ </ script >
12+ </ div >
13+ {% endif %}
Original file line number Diff line number Diff line change 1+ {% if site.adsense.client and site.adsense.show_ads %}
2+ < div class ="ad-floating ad-floating-left ">
3+ < ins class ="adsbygoogle "
4+ style ="display:block "
5+ data-ad-client ="{{ site.adsense.client }} "
6+ data-ad-slot ="2396306733 "
7+ data-ad-format ="vertical "
8+ data-full-width-responsive ="false "> </ ins >
9+ < script >
10+ ( adsbygoogle = window . adsbygoogle || [ ] ) . push ( { } ) ;
11+ </ script >
12+ </ div >
13+ < div class ="ad-floating ad-floating-right ">
14+ < ins class ="adsbygoogle "
15+ style ="display:block "
16+ data-ad-client ="{{ site.adsense.client }} "
17+ data-ad-slot ="2396306733 "
18+ data-ad-format ="vertical "
19+ data-full-width-responsive ="false "> </ ins >
20+ < script >
21+ ( adsbygoogle = window . adsbygoogle || [ ] ) . push ( { } ) ;
22+ </ script >
23+ </ div >
24+ {% endif %}
Original file line number Diff line number Diff line change 8787 <!-- Header -->
8888 {% include header.html %}
8989
90+ <!-- Floating Side Ads -->
91+ {% include ad-floating.html %}
92+
9093 <!-- Main Content -->
9194 < main class ="main-content ">
9295 {{ content }}
9396 </ main >
94-
97+
9598 <!-- Footer -->
9699 {% include footer.html %}
97100
Original file line number Diff line number Diff line change @@ -98,6 +98,8 @@ <h1 class="post-title">{{ page.title }}</h1>
9898 < div class ="post-content ">
9999 < div class ="container ">
100100 {{ content }}
101+
102+ {% include ad-banner.html %}
101103 </ div >
102104 </ div >
103105
@@ -181,3 +183,23 @@ <h3 class="nav-heading">{{ lang_data.ui.other_posts | default: "Other Posts" }}<
181183 } ) ;
182184 }
183185</ script >
186+
187+ {% if site.adsense.client and site.adsense.show_ads %}
188+ < script >
189+ document . addEventListener ( 'DOMContentLoaded' , function ( ) {
190+ var postContent = document . querySelector ( '.post-content .container' ) ;
191+ if ( ! postContent ) return ;
192+
193+ var paragraphs = postContent . querySelectorAll ( ':scope > p' ) ;
194+ if ( paragraphs . length < 6 ) return ;
195+
196+ var target = paragraphs [ 4 ] ;
197+ var adDiv = document . createElement ( 'div' ) ;
198+ adDiv . className = 'ad-container ad-in-article' ;
199+ adDiv . innerHTML = '<ins class="adsbygoogle" style="display:block" data-ad-client="{{ site.adsense.client }}" data-ad-slot="2396306733" data-ad-format="auto" data-full-width-responsive="true"></ins>' ;
200+ target . parentNode . insertBefore ( adDiv , target . nextSibling ) ;
201+
202+ ( adsbygoogle = window . adsbygoogle || [ ] ) . push ( { } ) ;
203+ } ) ;
204+ </ script >
205+ {% endif %}
Original file line number Diff line number Diff line change @@ -1797,3 +1797,40 @@ a:hover {
17971797 gap : var (--spacing-xs );
17981798 }
17991799}
1800+
1801+ /* ===========================
1802+ ADSENSE
1803+ =========================== */
1804+ .ad-container {
1805+ margin : 2rem 0 ;
1806+ text-align : center;
1807+ min-height : 100px ;
1808+ }
1809+
1810+ .ad-in-article {
1811+ margin : 2.5rem 0 ;
1812+ }
1813+
1814+ /* Floating side ads */
1815+ .ad-floating {
1816+ position : fixed;
1817+ top : 50% ;
1818+ transform : translateY (-50% );
1819+ width : 160px ;
1820+ z-index : 50 ;
1821+ display : none;
1822+ }
1823+
1824+ .ad-floating-left {
1825+ left : calc ((100vw - 1000px ) / 2 - 180px );
1826+ }
1827+
1828+ .ad-floating-right {
1829+ right : calc ((100vw - 1000px ) / 2 - 180px );
1830+ }
1831+
1832+ @media (min-width : 1400px ) {
1833+ .ad-floating {
1834+ display : block;
1835+ }
1836+ }
You can’t perform that action at this time.
0 commit comments