问题描述
比方说,我们在果园CMS两个页面。主页和公司介绍页面。我想使用一个RoyalSlider上有其自己的CSS文件的首页。我怎么有只在主页上,而不是关于我们的网页?
Let's say we have two pages in Orchard CMS. The homepage and the About US page. I want to use a RoyalSlider on the homepage which has its own CSS file. How do I include it only on the homepage and not on the about us page?
在果园CMS我使用的Contoso为主题,我尝试包括对 Layout.cshtml
使用 Style.Include的royalslider.css文件
但是这将包括在以上网站这是不是一个好的做法的所有页面的CSS文件。
In Orchard CMS I am using Contoso as the theme and I tried including the royalslider.css file on the Layout.cshtml
using Style.Include
but this will include the CSS file over all the pages in the website which is not a good practice.
推荐答案
您应该使用URL候补功能为。它描述,在部分的URL和Widget候补的。
You should use URL Alternates feature for that. It's described here, in the section "URL and Widget Alternates".
启用该功能后,复制 Layout.cshtml
你在你的主题中发现并将其重命名为布局-URL-homepage.cshtml
。这其中将只用于渲染网页,所以只需添加 Style.Include
来电那里,你设置。
After enabling the feature, copy the Layout.cshtml
you found in your theme and rename it to Layout-url-homepage.cshtml
. This one will only be used for rendering the homepage, so just add your Style.Include
calls there and you're set.
这篇关于添加不同的CSS文件,以在果园CMS不同的页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!