From cfb5c01418694aebb474f559c1adb08e17c02f36 Mon Sep 17 00:00:00 2001 From: ~m Date: Sun, 3 Dec 2023 22:18:59 +0700 Subject: [PATCH] add adsense option --- layouts/_default/archives.html | 1 + layouts/_default/single.html | 1 + layouts/partials/adsense-display.html | 10 ++++++++++ layouts/partials/adsense-inarticle.html | 10 ++++++++++ layouts/partials/adsense-infeed.html | 16 ++++++++++++++++ layouts/partials/adsense-multiplex.html | 9 +++++++++ layouts/partials/head.html | 1 + layouts/partials/templates/adsense.html | 6 ++++++ layouts/shortcodes/adarticle.html | 1 + layouts/shortcodes/addisplay.html | 1 + layouts/shortcodes/adfeed.html | 1 + layouts/shortcodes/admulti.html | 1 + 12 files changed, 58 insertions(+) create mode 100644 layouts/partials/adsense-display.html create mode 100644 layouts/partials/adsense-inarticle.html create mode 100644 layouts/partials/adsense-infeed.html create mode 100644 layouts/partials/adsense-multiplex.html create mode 100644 layouts/partials/templates/adsense.html create mode 100644 layouts/shortcodes/adarticle.html create mode 100644 layouts/shortcodes/addisplay.html create mode 100644 layouts/shortcodes/adfeed.html create mode 100644 layouts/shortcodes/admulti.html diff --git a/layouts/_default/archives.html b/layouts/_default/archives.html index d2c4d76b..44c8faf3 100644 --- a/layouts/_default/archives.html +++ b/layouts/_default/archives.html @@ -61,6 +61,7 @@ {{- end }} +{{- partial "adsense-infeed.html" $ -}} {{- end }} {{- end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index ee0fec43..6bdd9ccd 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -53,6 +53,7 @@ {{- if (.Param "comments") }} {{- partial "comments.html" . }} {{- end }} + {{ partial "adsense-multiplex.html" $ }} {{- end }}{{/* end main */}} diff --git a/layouts/partials/adsense-display.html b/layouts/partials/adsense-display.html new file mode 100644 index 00000000..24a8f453 --- /dev/null +++ b/layouts/partials/adsense-display.html @@ -0,0 +1,10 @@ + + + \ No newline at end of file diff --git a/layouts/partials/adsense-inarticle.html b/layouts/partials/adsense-inarticle.html new file mode 100644 index 00000000..708cd9b5 --- /dev/null +++ b/layouts/partials/adsense-inarticle.html @@ -0,0 +1,10 @@ + + + \ No newline at end of file diff --git a/layouts/partials/adsense-infeed.html b/layouts/partials/adsense-infeed.html new file mode 100644 index 00000000..1272bfb3 --- /dev/null +++ b/layouts/partials/adsense-infeed.html @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/layouts/partials/adsense-multiplex.html b/layouts/partials/adsense-multiplex.html new file mode 100644 index 00000000..cee842c6 --- /dev/null +++ b/layouts/partials/adsense-multiplex.html @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 35257fc7..08ce34bc 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -167,4 +167,5 @@ {{- template "partials/templates/opengraph.html" . }} {{- template "partials/templates/twitter_cards.html" . }} {{- template "partials/templates/schema_json.html" . }} +{{- template "partials/templates/adsense.html" . }} {{- end -}} diff --git a/layouts/partials/templates/adsense.html b/layouts/partials/templates/adsense.html new file mode 100644 index 00000000..bed70792 --- /dev/null +++ b/layouts/partials/templates/adsense.html @@ -0,0 +1,6 @@ +{{ $adsenseEnabled := (and .Site.Params "adsense" (ne .Params.disableAdsense true) ) }} +{{ $adsenseAllowedOnPage := (ne .Kind "404" )}} + +{{- if (and $adsenseEnabled $adsenseAllowedOnPage) }} + +{{- end }} \ No newline at end of file diff --git a/layouts/shortcodes/adarticle.html b/layouts/shortcodes/adarticle.html new file mode 100644 index 00000000..67955fc6 --- /dev/null +++ b/layouts/shortcodes/adarticle.html @@ -0,0 +1 @@ +{{ partial "adsense-inarticle.html" $ }} \ No newline at end of file diff --git a/layouts/shortcodes/addisplay.html b/layouts/shortcodes/addisplay.html new file mode 100644 index 00000000..6ec1008e --- /dev/null +++ b/layouts/shortcodes/addisplay.html @@ -0,0 +1 @@ +{{ partial "adsense-display.html" $ }} \ No newline at end of file diff --git a/layouts/shortcodes/adfeed.html b/layouts/shortcodes/adfeed.html new file mode 100644 index 00000000..85ab2866 --- /dev/null +++ b/layouts/shortcodes/adfeed.html @@ -0,0 +1 @@ +{{ partial "adsense-infeed.html" $ }} \ No newline at end of file diff --git a/layouts/shortcodes/admulti.html b/layouts/shortcodes/admulti.html new file mode 100644 index 00000000..7462373e --- /dev/null +++ b/layouts/shortcodes/admulti.html @@ -0,0 +1 @@ +{{ partial "adsense-multiplex.html" $ }} \ No newline at end of file