Last active
August 5, 2019 21:12
-
-
Save rabehasy/8e9c4c36d2865dcae41224f719612cc6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hexo.extend.tag.register('googleads', function(args) { | |
if (args.length !== 3) { | |
return ''; | |
} | |
let layout = args[0]; // ex: in-article | |
let format = args[1]; // ex: fluid | |
let slot = args[2]; | |
let sHtml = '<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>' + "\n"; | |
sHtml += '<ins class="adsbygoogle"' + "\n"; | |
sHtml += 'style="display:block; text-align:center;"' + "\n"; | |
sHtml += 'data-ad-layout="' + layout + '"' + "\n"; | |
sHtml += 'data-ad-format="' + format + '"' + "\n"; | |
sHtml += 'data-ad-client="ca-pub-***********"' + "\n"; | |
sHtml += 'data-ad-slot="' + slot + '"' + "\n"; | |
sHtml += '></ins>' + "\n"; | |
sHtml += '<script>' + "\n"; | |
sHtml += '(adsbygoogle = window.adsbygoogle || []).push({});' + "\n"; | |
sHtml += '</script>' + "\n"; | |
return sHtml; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment