mirror of
https://github.com/adityatelange/hugo-PaperMod.git
synced 2023-12-21 10:22:58 +01:00
add adsense option
This commit is contained in:
parent
b288ede80c
commit
cfb5c01418
@ -61,6 +61,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</div>
|
</div>
|
||||||
|
{{- partial "adsense-infeed.html" $ -}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
{{- if (.Param "comments") }}
|
{{- if (.Param "comments") }}
|
||||||
{{- partial "comments.html" . }}
|
{{- partial "comments.html" . }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{ partial "adsense-multiplex.html" $ }}
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
{{- end }}{{/* end main */}}
|
{{- end }}{{/* end main */}}
|
||||||
|
10
layouts/partials/adsense-display.html
Normal file
10
layouts/partials/adsense-display.html
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<!-- ad-display -->
|
||||||
|
<ins class="adsbygoogle"
|
||||||
|
style="display:block"
|
||||||
|
data-ad-client="{{- .Site.Params.adsense.clientID -}}"
|
||||||
|
data-ad-slot="{{- .Site.Params.adsense.slotDisplay -}}"
|
||||||
|
data-ad-format="auto"
|
||||||
|
data-full-width-responsive="true"></ins>
|
||||||
|
<script>
|
||||||
|
(adsbygoogle = window.adsbygoogle || []).push({});
|
||||||
|
</script>
|
10
layouts/partials/adsense-inarticle.html
Normal file
10
layouts/partials/adsense-inarticle.html
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<!-- ad-in-article -->
|
||||||
|
<ins class="adsbygoogle"
|
||||||
|
style="display:block; text-align:center;"
|
||||||
|
data-ad-layout="in-article"
|
||||||
|
data-ad-format="fluid"
|
||||||
|
data-ad-client="{{- .Site.Params.adsense.clientID -}}"
|
||||||
|
data-ad-slot="{{- .Site.Params.adsense.slotInArticle -}}"></ins>
|
||||||
|
<script>
|
||||||
|
(adsbygoogle = window.adsbygoogle || []).push({});
|
||||||
|
</script>
|
16
layouts/partials/adsense-infeed.html
Normal file
16
layouts/partials/adsense-infeed.html
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<!-- ad-in-feed -->
|
||||||
|
<ins class="adsbygoogle"
|
||||||
|
style="display:block"
|
||||||
|
data-ad-format="fluid"
|
||||||
|
data-ad-layout-key="-gw-3+1f-3d+2z"
|
||||||
|
data-ad-client="{{- .Site.Params.adsense.clientID -}}"
|
||||||
|
data-ad-slot="{{- .Site.Params.adsense.slotInFeed -}}"></ins>
|
||||||
|
<!-- <ins class="adsbygoogle imgtheme-dark"
|
||||||
|
style="display:block"
|
||||||
|
data-ad-format="fluid"
|
||||||
|
data-ad-layout-key="-gw-3+1f-3d+2z"
|
||||||
|
data-ad-client="{{- .Site.Params.adsense.clientID -}}"
|
||||||
|
data-ad-slot="{{- .Site.Params.adsense.slotInFeedDark -}}"></ins> -->
|
||||||
|
<script>
|
||||||
|
(adsbygoogle = window.adsbygoogle || []).push({});
|
||||||
|
</script>
|
9
layouts/partials/adsense-multiplex.html
Normal file
9
layouts/partials/adsense-multiplex.html
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<!-- ad-multiplex -->
|
||||||
|
<ins class="adsbygoogle"
|
||||||
|
style="display:block"
|
||||||
|
data-ad-format="autorelaxed"
|
||||||
|
data-ad-client="{{- .Site.Params.adsense.clientID -}}"
|
||||||
|
data-ad-slot="{{- .Site.Params.adsense.slotMultiplex -}}"></ins>
|
||||||
|
<script>
|
||||||
|
(adsbygoogle = window.adsbygoogle || []).push({});
|
||||||
|
</script>
|
@ -167,4 +167,5 @@
|
|||||||
{{- template "partials/templates/opengraph.html" . }}
|
{{- template "partials/templates/opengraph.html" . }}
|
||||||
{{- template "partials/templates/twitter_cards.html" . }}
|
{{- template "partials/templates/twitter_cards.html" . }}
|
||||||
{{- template "partials/templates/schema_json.html" . }}
|
{{- template "partials/templates/schema_json.html" . }}
|
||||||
|
{{- template "partials/templates/adsense.html" . }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
6
layouts/partials/templates/adsense.html
Normal file
6
layouts/partials/templates/adsense.html
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{{ $adsenseEnabled := (and .Site.Params "adsense" (ne .Params.disableAdsense true) ) }}
|
||||||
|
{{ $adsenseAllowedOnPage := (ne .Kind "404" )}}
|
||||||
|
|
||||||
|
{{- if (and $adsenseEnabled $adsenseAllowedOnPage) }}
|
||||||
|
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client={{- .Site.Params.adsense.clientID -}}" crossorigin="anonymous"></script>
|
||||||
|
{{- end }}
|
1
layouts/shortcodes/adarticle.html
Normal file
1
layouts/shortcodes/adarticle.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
{{ partial "adsense-inarticle.html" $ }}
|
1
layouts/shortcodes/addisplay.html
Normal file
1
layouts/shortcodes/addisplay.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
{{ partial "adsense-display.html" $ }}
|
1
layouts/shortcodes/adfeed.html
Normal file
1
layouts/shortcodes/adfeed.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
{{ partial "adsense-infeed.html" $ }}
|
1
layouts/shortcodes/admulti.html
Normal file
1
layouts/shortcodes/admulti.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
{{ partial "adsense-multiplex.html" $ }}
|
Loading…
Reference in New Issue
Block a user