Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Add eye icon for count view for Portal widget

Winnie P
Mega Sage

Hello there, Just wondering how would you show the eye icon for view count on a Widget portal - would this be scripted in the Body HTML template of the Widget? The eye icon shows on the Widget above but I can't seem to get it to show for the Widget below?  I have tried copying the script from the widget where it is showing but no luck. Thank you.

find_real_file.png

1 ACCEPTED SOLUTION

Mohith Devatte
Tera Sage
Tera Sage

Hello @Winnie Poelima ,

did you clone the widget ?

Because it looks like you have cloned the OOB KB Most Viewed widget .

For the eye icon usually there will be OOB code which eye glyph icon 

find_real_file.png

  <glyph sn-char="eye-open" class="pad-right" />

this is the exact line

<sp-panel ng-if="data.articles.length > 0" >
  <ul class="list-group">
    <li class="list-group-item" ng-repeat="a in data.articles">
      <a href="?id=kb_article&sys_id={{::a.sys_id}}">{{::a.short_description}}</a>
      <div>
        <span ng-if="a.sys_view_count == 1" class="views pad-right">
          <glyph sn-char="eye-open" class="pad-right" />
          ${{{::a.sys_view_count}} View}
        </span>
        <span ng-if="a.sys_view_count > 1" class="views pad-right">
          <glyph sn-char="eye-open" class="pad-right" />
          ${{{::a.sys_view_count}} Views}
        </span>
        <span ng-if="false" class="published pad-right">
          <span ng-if="a.sys_view_count > 0" class="pad-right">&#8226;</span> <glyph sn-char="calendar" class="pad-right" />
          <sn-day-ago date="a.published"/>
        </span>
      </div>
    </li>
  </ul>
</sp-panel>

if you have cloned the widget then this line should be there 

hope this helps 

please mark my answer correct if it helps you

View solution in original post

4 REPLIES 4

Mohith Devatte
Tera Sage
Tera Sage

Hello @Winnie Poelima ,

did you clone the widget ?

Because it looks like you have cloned the OOB KB Most Viewed widget .

For the eye icon usually there will be OOB code which eye glyph icon 

find_real_file.png

  <glyph sn-char="eye-open" class="pad-right" />

this is the exact line

<sp-panel ng-if="data.articles.length > 0" >
  <ul class="list-group">
    <li class="list-group-item" ng-repeat="a in data.articles">
      <a href="?id=kb_article&sys_id={{::a.sys_id}}">{{::a.short_description}}</a>
      <div>
        <span ng-if="a.sys_view_count == 1" class="views pad-right">
          <glyph sn-char="eye-open" class="pad-right" />
          ${{{::a.sys_view_count}} View}
        </span>
        <span ng-if="a.sys_view_count > 1" class="views pad-right">
          <glyph sn-char="eye-open" class="pad-right" />
          ${{{::a.sys_view_count}} Views}
        </span>
        <span ng-if="false" class="published pad-right">
          <span ng-if="a.sys_view_count > 0" class="pad-right">&#8226;</span> <glyph sn-char="calendar" class="pad-right" />
          <sn-day-ago date="a.published"/>
        </span>
      </div>
    </li>
  </ul>
</sp-panel>

if you have cloned the widget then this line should be there 

hope this helps 

please mark my answer correct if it helps you

@Winnie Poelima did this work ?

any follow up required ? if yes let me know 

if not close the thread by marking the answer correct so that it will be helpful to future readers

Yes thank you Mohith, it worked & I've ticked this as 'marked as Correct Answer'.  I posted another question regarding adding the eye glyph to "knowledge MostUseful articles' widget. Regards Winnie.

Thank you Mohith that worked! I initially cloned this Widget: Knowledge MostViewed Articles and tried to modify the scripts in there, but wasn't working.  When I added the OOTB widget: KB Most Viewed to the instance, it works as expected. Not sure what the difference is between the 2 widgets? I have another query to do the same to the Knowledge MostUseful Article which I cloned and trying to copy scripts, but currently not working? I will do more testing and if no luck will post a separate question for it.  Appreciate your time! Regards Winnie