• Resolved dschitra

    (@dschitra)


    <script async src='https://cse.google.com/cse.js?cx=partner-pub-4363922843610542:5346169524'></script><div class="gcse-searchbox-only"></div>

    this is my Google Custom search engine code for my site, i want to show GCS on amp pages also, is there any way?

Viewing 9 replies - 1 through 9 (of 9 total)
  • @dschitra Good question, it may be something more appropriate for the GitHub repository, the same query was asked previously. You may need to use the amp-script component or an amp-frame solution.

    Are you looking to keep the search results within your own site as opposed to directing users to an offsite search page?

    Thread Starter dschitra

    (@dschitra)

    i want to redirect to google self search result page.

    @dschitra Can you try the below:

    <form method="GET" action="https://www.google.com/cse" target="_top">
      <div class="amp-customsearch">
       <input name="cx" type="hidden" value="partner-pub-4363922843610542:5346169524" />
       <input name="ie" type="hidden" value="UTF-8" />
       <input type="search" placeholder="Search..." name="q" required>
       <input type="submit" value="Go" class="search-links">
      </div>
     </form

    Let me know if that works for you, alternatively can you try the suggestion here.

    Thread Starter dschitra

    (@dschitra)

    where i put my google cse id?

    @dschitra I’ve provided it in that code snippet. Let me know if that works for you after adding to a custom HTML block.

    Thread Starter dschitra

    (@dschitra)

    it is working but it shows non-amp urls in search queries

    Thread Starter dschitra

    (@dschitra)

    thanks for helping me….

    One thing more can i use this code for amp and non-amp both pages as well?

    @dschitra

    it is working but it shows non-amp urls in search queries

    That’s down to how search engines determine the most suitable links I suspect. Did you check from mobile? You can ask the product experts using the Search Console Help Center.

    One thing more can i use this code for amp and non-amp both pages as well?

    Yes, you can use in both AMP and non AMP.

    thanks for helping me….

    No problem, feel free to leave the plugin a review.

    It’s safe for Google Adsense Policy?

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘google custom search for amp pages code’ is closed to new replies.