Skip to main content
NICE CXone Expert
Expert Success Center

Conditional headers

Applies to:
All MindTouch Versions
Role required:
Admin
Conditionalize the header and footer of your Expert site with self-service branding.

How the conditional header works

The dynamic custom header is a simple structure. The standard Expert header has code to determine if it should dynamically embed content from another page we call conditional headers.

The Header node in the example diagram would use DekiScript to:

  1. Get the page path, for examplesuccess.yoursite.com/path/path/path.
  2. Determine if it should dynamically embed a conditional header.
  3. Use a DekiScript function to load the conditional header. 


Example

If the page path is /Documentation, load the header at /Template:Custom/View/Header/Documentation.

Conditional headers are not supported on special pages such as search, login screen and password screen. Special pages only support one default header.

Configure your conditional headers

To configure your conditional header, create an Expert template for each variation of the header.

  1. Navigate to your header template.

    By default, your header template should be located at Custom > Views > Header. If you do not have a header template at this location, contact a Expert Support agent to get self-service branding setup.
     
  2. Create a separate page for each conditional header.
  3. Add content into your header to indicate which header is loading.
  4. If you find yourself creating more than six templates, you may want to reconsider your approach. More than six conditional headers will be hard to manage and may have performance complications.
  5. Navigate to Site tools Dashboard > Site Adminisration > Template directory.  
  6. Locate the custom header at Templates > Custom > Views > Header    (Path:   /Template:Custom/Views/Header)
  7. Add HTML, CSS, JavaScript and DekiScript to your custom header to create a dynamic layout.

Dynamically display your conditional header

Create logic to display different headers for different paths or conditions.

  1. Use an IF statement to dynamically load one of the conditional headers.
  2. Add the following DekiScript to your header template.
// GET THE PAGE PATH AND SPLIT IT BY FORWARD SLASHES
// EXAMPLE PATH = /Documentation/Administration/Analyzing_Knowledge
// SPLIT PATH = [ "Documentation", "Administration", "Analyzing_Knowledge" ]
var current = string.split(page.path,"/");


// GET THE FIRST ITEM IN THE PATH LIST
var section = current[0];


// TEST THE CONDITIONS AND EMBED THE CONDITIONAL HEADER USING A TEMPLATE() CALL. 
if (#current && section == "Contact_Us")
{
   template("Custom/Views/Header/Contact_Us");
}
if (#current && section == "Documentation")
{
    template("Custom/Views/Header/Documentation");
}

Display a header for different users

Expert allows you to show a different header for users in different groups regardless of the page path. For example, your developer may need to access more technical resources than your administrative teams or you may want users in the contributor group to be reminded of your technical writing standards:

  1. Create a developer and contributor group.
  2. Add users accordingly.
  3. Add the following DekiScript to your header template:
// TEST THE CONDITIONS AND EMBED THE CONDITIONAL HEADER USING A TEMPLATE() CALL.
if (user.groups["developer"])
{
    template("Custom/Views/Header/Developer");
}
if (user.groups["contributor"])
{
    template("Custom/Views/Header/Contributor");
}
  • Was this article helpful?