How to auto hide Support Resources widget on Topic template, when no connected items are linked to

Alex87
Tera Contributor

Hi,

I'm looking for a way, how I can hide the Support resources widget on the default topic template page when there are no connected items linked to it. Anyone have some ideas how to do this? I have seen some companies have managed that. 

 

Thank you.

 

Alex87_0-1695280719338.png

 

11 REPLIES 11

I know we made it visible (temporarily) by adding a quick link to the page. However, the desire would be to only have rich content visible on a topic page and nothing further, as his new functionality will likely remove knowledge articles from a few topic areas in our content structure so the Support Resources section becomes unnecessary.

 

We did think about creating a 2nd topic template for pages that will only have microsites, but this still will not work unless there is something else connected as you note above. The page should recognize rich content as something "connected" but currently it does not. As for the original poster, it appears they have a microsite item posted but I can't speak on their behalf... 

Alex87
Tera Contributor

Hi, here is a picture from Nasdaq where they use the OOTB Topic template, but somehow have many to hide the support resource widget. I have another picture with the same template, but than the widget is visible. 

Alex87_0-1698668042929.png

 

Alex87
Tera Contributor

And here with the support resources. Exact same Template (see url)

Alex87_1-1698668181121.png

 

Mindaugas_0x
Tera Contributor

I had a similar situation and used this approach:

1)Create a new widget

2)Embed support resources widget when condition is satisfied in the server script via ng-if. This keeps widget upgrades for support resources and lets you hide/show it when needed. For example:

//getting widget
data.contentWidget = $sp.getWidget('topic_content');

//setting some flag
data.lowestTierTopic = false;

if (childTopics.topics.length == 0) {
data.lowestTierTopic = true;
}

//using this data in html template
<div ng-if="data.lowestTierTopic">
<sp-widget widget="data.contentWidget"></sp-widget>
</div>

 

I guess my point would be why script a new widget? The purpose of the topic templates is so you can make your own templates for when needed.

- Create a Topic template that is for a page with written content, but does not require connected content.

- Create a Topic template that is for a page with written content, but also requires connected content.