3
如何从Sitecore Lucene搜索获取格式化的网址?我创建了一个自定义索引,并在根目录下将其更新为/ sitecore/content/websitename/home。Sitecore搜索Api - 如何获得格式化的网址
当检索到搜索结果时,URL会附加https://hostname/websitename/home/sample.aspx。我想要的网址是https://hostname/sample.aspx。索引配置中是否有需要更新的设置?
在sites.config我已经有ROOTPATH = “/ Sitecore的/内容/ websitename” 起始物品= “/家”
感谢您的提示,我带着第二个选项。不过,我仍然需要获取上下文网站。这是我已经实现(如果任何人需要):Item item =可索引为SitecoreIndexableItem; (item!= null) var options = LinkManager.GetDefaultUrlOptions(); options.Site = SiteContext.GetSite(“website”); return“https”+ LinkManager.GetItemUrl(item,options); } – Vamshi
请勿使用url模式进行硬编码。使用方法获取当前模式:public static string GetScheme() { HttpContext current = HttpContext.Current; if(current!= null) return current.Request.Url.Scheme; return string.Empty; } –