如何将html链接标记添加到使用sitecore应用程序共享的布局的页面。 [英] How to add a html link tag to a page which uses a layout shared across an application from sitecore.
问题描述
我有一个基于ASP.net和Sitecore的应用程序。应用程序使用sitecore的公共布局(.aspx文件)。
现在我必须添加头部分下的链接标记(< link rel =xxxhref =yyy/>)到单个页面。要实现这一点,我必须编辑公共布局,但链接标记应该只出现在页面I上想要而不是在其他页面上。我怎么能实现这个目标?
我将以下代码添加到我的公共layout.aspx但是它不起作用我不喜欢我不明白它的作用。
<%string currentURL = Request.RawUrl;
if(currentURL ==/) {%>
< link rel =xxxhref =yyy/>
<%}%>
为什么我们使用< %%>?
I have an application built on ASP.net and Sitecore.The application uses a common layout(.aspx file) from sitecore.
Now I have to add a link tag(<link rel="xxx" href="yyy" />) under head section to a single page.To achieve this,I have to edit common layout but the link tag should appear only on the page I want and not on other pages.How can I achieve this?
I got the below code to add to my common layout.aspx but it is not working and I don't understand what it does.
<% string currentURL = Request.RawUrl;
if (currentURL == "/") {%>
<link rel="xxx" href="yyy" />
<% } %>
why we use <% %>?
推荐答案
这与Sitecore细节无关,这只是分离服务器端代码和HTML标记的ASP.NET语法。我建议在了解如何在sitecore中使用它之前阅读其工作原理
This has nothing to do with Sitecore specifics, this is just ASP.NET syntax of separating Server side code and the HTML markup. I recommend to read on how this works before understanding how it is used within your sitecore
这篇关于如何将html链接标记添加到使用sitecore应用程序共享的布局的页面。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!