Creating a custom search page

This pageapplies toApigee andApigee hybrid.

View Apigee Edge documentation.

To enable search of the publicly available content in your portal, you can create a dedicated search page where you embed aGoogle Custom Search Engine (CSE).

Click for larger image

Click for larger image

Before embedding a Google custom search engine, note the following:

To create a custom search page:

  1. Publish your portal content.
  2. Create a Google custom search engine:

    1. Navigate to theGoogle custom search configuration page.
    2. ClickAdd to create a new custom search engine.
    3. Configure your custom search engine and identify the portal site domain.SeeCreate a search engine in the Google CustomSearch Help. The custom search configuration returns something likethe following:
      <script async src="https://cse.google.com/cse.js?cx=e13bcb52d46f04dfd"></script><div></div>
      Wherecx=e13bcb52d46f04dfd is the Google search engine ID.
    Tip: You can expedite site indexing by verifying and submitting yoursite using Google Search Console. SeeVerify your site in Search console in the Google Search Console Help.
  3. Add the following custom script to your portal. SeeAdding custom scripts.

    Set thecx variable to your Google search engine ID, for examplee13bcb52d46f04dfd, and thepath value to your search page URL,for example,/search.

    <script>window.portal={pageEventListeners:{onLoad:(path)=>{//UpdatewithyoursearchpageURLif(path==='/your-search-page-URL'){//AddyourGooglesearchengineIDvarcx='your-search-engine-id';vargcse=document.createElement('script');gcse.type='text/javascript';gcse.async=true;gcse.src='https://cse.google.com/cse.js?cx='+cx;vars=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(gcse,s);gcse.onload=function(){varsearch=document.createElement('gcse:search');//NotetheelementIDnamevarsearchBox=document.getElementById('search-box');searchBox.appendChild(search);};}}}};</script>
  4. Create a new search page in your portal and customize it as described inManage pages in your portal.

  5. Add the custom search element ID (search-box) defined in your customscript at the location that you want the Google search box to appear.For example<div id="search-box"></div>

  6. Add the search page to your portal navigation, as described inSet up navigation.

  7. Publish your search page and navigation updates.

It takes time for Google to index your site so you may not see search results right away. (It can take a couple of days up to a month to complete full indexing.) You may want to delay publishing the search page until you have tested your portal site search (over time) and are satisfied with the results being returned.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.