I have my Google Custom Search Engine (GCSE) code:
<script>
(function() {
var cx = '008589157460623253837:mhsjluzrngo';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
However my Accelerated Mobile Pages (AMP) site does not allow me to add JavaScript to it, and I don't see any AMP components that allow for embedding GCSE into an AMP site.
How can I get GCSE on my site without breaking AMP compliance?
Thanks
You can try putting that code in a separate page then including that page in your AMP via the amp-iframe
component. You will also have to abide by the constraints described here: https://www.ampproject.org/docs/reference/components/amp-iframe
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With