Skip to main content
NICE CXone Expert
Expert Success Center

Recently modified pages targeting specific tags

Uses DekiScript to dynamically list out the ten most recent articles that have been tagged with a specific tag.  Display a dynamic list of draft articles or display featured articles on your homepage.

Prerequisite

Depending on the articles you want to surface, the Expert default classifications may not suffice. Use custom classifications to control which articles to surface.

Part 1: Create your template

  1. Navigate to Site toolsDashboard > Site Administration > Template Directory (/Template:).
  2. Navigate to Template:Custom.*
  3. Click New.
  4. Save the page as TaggedArticlesWidget.

* For this example, we assume your template is located at /Template:Custom/TaggedArticlesWidget

Do not modify or add any templates in Templates:Expert.

Part 2: Add DekiScript to your template

Now that you have created a new template, you are ready to add the DekiScript code block to your page. Perform the following steps:

  1. Open your TaggedArticlesWidget template in Edit mode.
  2. In the editor toolbar, click the Styles drop-down list and select DekiScript.
  3. Paste the following into the DekiScript code block:
var query = "tag:stage:draft";
var pages = wiki.getSearch(query, 10, "-date");

<div class="widget-tagged-articles">
    <ul>
        foreach (var pg in pages)
        {
            <li>
                <a href=(pg.uri)>pg.title</a>
                <span class="date">
                    "( edited ";
                        date.format(pg.date,"ddd MMM dd, yyyy");
                    " )"
                </span>
            </li>
        }
    </ul>
</div> 
  1. Locate the var query

var query highlighted .png

  1. Modify the var query to reflect the classification and tag of articles you want to display (for example replace "tag:stage:draft" with your own classification "tag:language:english" ).
  2. Click Save.

You must specify both the classification and tag, or the code will not return any results. If you are unsure, review your classifications and tags in the control panel (under System Settings > Classifications).

Part 3: (Optional) Customize the look and feel of your template

Now that you have created your template and added the DekiScript, you have the option to customize the way the date is displayed in your list. Perform the following to add CSS to your template:

  1. Open your TaggedArticlesWidget template in Edit mode.
  2. Insert the cursor at the bottom of the page.
  3. In the editor toolbar, click the Styles drop-down list and select CSS.
  4. Paste the following into the CSS code block:
.widget-tagged-articles .date{
    margin:0 0 0 5px;
    font-size:10px;
    font-style: italic;
    color:#999
    }
  1. Modify the CSS as desired. 
  2. Click Save.

If the cursor only shows up in the DekiScript block, press Shift+Enter to escape it. 

Part 4: Add your template to a page

Now that your template is complete, you are ready to embed it into an Expert page. While most users will find this information valuable on your homepage, you may embed your template into any Expert page:

  1. Navigate to the page on which you want to display the list.
  2. On the Expert toolbar, click Edit.
  3. Locate where on the page you want to add the widget (even in a table, if you want).
  4. Add the following DekiScript and click Save.
template("TaggedArticlesWidget");

Demo

*There is a known issue with this tutorial returning duplicate results. This issue is currently being resolved.
  • Was this article helpful?