Define the ResourceLinks widget

The ResourceLinks widget is of type Telerik.Sitefinity.Web.UI.ResourceLinks.

The ResourceLinks widget contains collection of links in the form of ResourceFile(s). This means that you can include several references with a single ResourceLinks widgets. The following code registers CSS files from the appropriate theme folder, located in the CSS folder of the theme folder. You can register any number of resources inside one widget, by adding Resource elements, as in the following example:

The widget loads the files from the currently selected theme folder.

For example, if the currently selected theme is Default, the widget registers the following files:

  • Telerik.Sitefinity.Resources.Themes.Default.CSS.Layout.css
  • Telerik.Sitefinity.Resources.Themes.Default.CSS.dashboard.css

If the user changes the theme to Black, then the widget registers following files:

  • Telerik.Sitefinity.Resources.Themes.Black.CSS.Layout.css
  • Telerik.Sitefinity.Resources.Themes.Black.CSS.dashboard.css

External theme

ResourceLinks widget also provides an option to work with external themes. 
In the following example, the UseEmbeddedThemes property is set to false:

In this case, ResourceLinks registers the following CSS files:

  • ~/SitefinityExternal/Themes/Default/CSS/Layout.css
  • ~/SitefinityExternal/Themes/Default/CSS/dashboard.css

The path depends on the currently selected theme. If the user selects theme Black, the widget registers following files:

  • ~/SitefinityExternal/Themes/Black/CSS/Layout.css
  • ~/SitefinityExternal/Themes/Black/CSS/dashboard.css

The ResourceLinks widget automatically generates the paths to resources, based on the themes.

Static resources

If you want to use files that are the same for all themes, such as a reset style sheet or global layout style sheet file, you must use the Static property. When you declare a resource as static, the resource is always retrieved from the same location. 

You do this by declaring the resource as static and providing a virtual path to it, as in the following example: 

Regardless of the currently selected theme, the first file is always retrieved from root/SitefinityExternal/Layout.css location. 

You can use static and dynamic files inside of one collection of resources. Resources are registered in the order, in which they are declared. Sitefinity CMS determines the type of resource, based on its extension, and generates the proper markup.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?