小编mCp*_*RLX的帖子

将 Google 自定义搜索添加到 AMP 站点

我有我的 Google 自定义搜索引擎 (GCSE) 代码:

<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>
Run Code Online (Sandbox Code Playgroud)

但是,我的 Accelerated Mobile Pages (AMP) 站点不允许我向其中添加 JavaScript,并且我没有看到任何允许将 GCSE 嵌入到 AMP 站点的 AMP 组件。

如何在不违反 AMP 合规性的情况下在我的网站上获得 GCSE?

谢谢

amp-html

5
推荐指数
1
解决办法
1614
查看次数

标签 统计

amp-html ×1