diff options
author | Asur <asur@asurbernardo.com> | 2020-07-24 19:35:31 +0300 |
---|---|---|
committer | Asur <asur@asurbernardo.com> | 2020-07-24 19:35:31 +0300 |
commit | 9824512d4eed990c75e2d223a8593c94891a7ce5 (patch) | |
tree | c73d5cc706138d49b57af1b01d5a7af14a54f73b | |
parent | 45c82e6e25d22371106dc9801f1503a91700ad49 (diff) |
Simplify adsense ad shortcode
-rw-r--r-- | layouts/partials/shortcodes/amp-adsense.html | 33 |
1 files changed, 7 insertions, 26 deletions
diff --git a/layouts/partials/shortcodes/amp-adsense.html b/layouts/partials/shortcodes/amp-adsense.html index dc1c817..270abdb 100644 --- a/layouts/partials/shortcodes/amp-adsense.html +++ b/layouts/partials/shortcodes/amp-adsense.html @@ -1,34 +1,15 @@ -{{ if isset $.Site.Params "adsensepublisher" }} - {{ with .Params }} +{{ with $.Site.Params.AdsensePublisher }} <fieldset class="ad"> <legend><strong>#ad</strong></legend> <amp-ad type="adsense" - {{ with .class }} class="{{ . }}"{{ end }} - {{ with .alt }} alt="{{ . }}"{{ end }} - {{ with .width }} width="{{ . }}"{{ end }} - {{ with .height }} height="{{ . }}"{{ end }} - {{ with .layout }} layout="{{ . }}"{{ end }} - {{ with .slot }} data-ad-slot="{{ . }}" {{ end }} + {{ with $.Params.Class }} class="{{ . }}"{{ end }} + {{ with $.Params.Alt }} alt="{{ . }}"{{ end }} + {{ with $.Params.Width }} width="{{ . }}"{{ end }} + {{ with $.Params.Height }} height="{{ . }}"{{ end }} + {{ with $.Params.Layout }} layout="{{ . }}"{{ end }} + {{ with $.Params.Slot }} data-ad-slot="{{ . }}" {{ end }} data-ad-client="{{ $.Site.Params.adsensePublisher }}"> <div class="ad__fallback" fallback><p>{{ i18n "noAd" }}</p></div> </amp-ad> </fieldset> - {{ end }} -{{ else }} - {{ if isset . "context" }} - {{ $publisher := .context.Site.Params.adsensePublisher }} - <fieldset class="ad"> - <legend><strong>#ad</strong></legend> - <amp-ad type="adsense" - {{ with .class }} class="{{ . }}"{{ end }} - {{ with .alt }} alt="{{ . }}"{{ end }} - {{ with .width }} width="{{ . }}"{{ end }} - {{ with .height }} height="{{ . }}"{{ end }} - {{ with .layout }} layout="{{ . }}"{{ end }} - {{ with .slot }} data-ad-slot="{{ . }}" {{ end }} - data-ad-client="{{ $publisher }}"> - <div class="ad__fallback" fallback><p>{{ i18n "noAd" }}</p></div> - </amp-ad> - </fieldset> - {{ end }} {{ end }}
\ No newline at end of file |