Creating a Sitewide Search Results page - NCIOCPL/cgov-digital-platform GitHub Wiki

Every microsite has its own sitewide search results page.

Creating this page requires the site_admin role.

[!NOTE] English and Spanish search result page are separate content items; they are not translations. They are created separately with different values for the language field.

  1. Login to the CMS.
  2. In the admin menu, go to Content > Add content > Application page
  3. Set the language according to whether this is the English or Spanish search page.
  4. Set these fields as specified:
    • Site Section: set as desired. (We are not consistent on this, some sites use the root site section, others use one named "search.")
    • Pretty URL:
      • If the site section is the root, this will need to be something like "search-results" so that it's unique.
      • If the site section has no other children, the pretty url does not need to be set.
      • This is likely a topic to discuss with the project's information architect (IA).
    • Page Title, Browser Title, and Meta Description fields should be set to something like the DOC's name, and the word "Search". (e.g. "DCTD Search")
      • This should also be discussed with the project's IA.
    • Date Display Mode: leave these checkboxes unset.
    • Application Module: JS-Only App Module
    • App Module Instance Setting: (see below)
    • Search Engine Restrictions: Exclude from search
    • Enable Push State: Leave unchecked
    • Application Module Page Template: Hide Left Nav
  5. Set "Save as" to Published and click "Save"

App Module Instance Setting field

When setting the App Module Instance Setting field, copy and paste the following structure and then edit as detailed below.

{
    "drupalConfig": {
        "appName": "sitewide-search-app",
        "rootId": "NCI-sws-app-root",
        "initFnName": "window.SitewideSearchApp",
        "appCssUri": "https:\/\/www.cancer.gov\/app-modules\/sitewide-search-app\/sitewide-search-app.v1.4.0\/static\/css\/main-legacy.css",
        "appJsUri": "https:\/\/www.cancer.gov\/app-modules\/sitewide-search-app\/sitewide-search-app.v1.4.0\/static\/js\/main.js",
        "removeHeadElements": [],
        "validAppPaths": []
    },
    "frontEndConfig": {
        "analyticsChannel": "@@TOKEN@@[cgov_tokens:cgov-analytics-channel]",
        "analyticsContentGroup": "@@TOKEN@@[cgov_tokens:cgov-analytics-group]",
        "analyticsPublishedDate": "@@TOKEN@@[node:field_date_posted:date:short]",
        "dropdownOptions": [
            20,
            50
        ],
        "searchCollection": "doc",
        "searchSiteFilter": "MYSITE.cancer.gov",
        "searchEndpoint": "@@LITERAL@@window.CDEConfig.sitewideSearchConfig.searchApiServer",
        "siteName": "@@TOKEN@@[cgov_tokens:cgov-trans-org-name]",
        "title": "@@TOKEN@@[node:field_browser_title:value]"
    }
}

Set these properties:

  • searchCollection - This will always be doc. Only the main www.cancer.gov site uses the cgov collection.
  • searchSiteFilte - This is the micro sites base URL (no leading https). For a top-level site, this will be just the host name (e.g. sbir.cancer.gov. For a path-based site (e.g. /connect-prevention-study), this will be the hostname, and path to the base of site (e.g. www.cancer.gov/connect-prevention-study).