Create a custom search page (original version)

You're viewing Apigee Edge documentation.
Go to the Apigee X documentation.
info

To enable app developers to search the content in your portal, you can create a custom search page and embed a Google custom search engine.

search

To create a custom search page:

  1. Publish your live portal, as described in Publish your portal content.
  2. Create a Google custom search engine:
    a. Navigate to the Google custom search configuration page.
    b. Click Add to create a new custom search engine.

    Google custom search engine

    c. Configure your custom search engine and identify the portal site domain. See Create a search engine in the Google Custom Search Help.
    d. Expedite site indexing by verifying and submitting your site using Google WebMaster tools. See Verify your site in Search Console in the Google Custom Search Help.

  3. Create a new search page in your API portal and customize it as desired. See Manage pages in your portal.

  4. Embed the custom search engine code in the new search page. For complete details, see Add custom search to your site in the Google Custom Search Help.
    For example:

    
    <div class="search-area">
    <script>
       (function() {
          var cx = '00000000000000:xxxxxxxxxxx7g';
          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>
    <gcse:search></gcse:search>
    </div>
    

  5. Add the search page to your portal navigation, as required. See Set up navigation for more information.

  6. Publish your search page and navigation updates.

    Note: 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.