摆脱 Sitecore 链接前缀 (sitecore/content/..)

发布于 2024-09-18 05:07:09 字数 210 浏览 3 评论 0原文

我有一个包含多个站点的 Sitecore 解决方案。所有站点都在 SiteDefinition.Config 中设置,我可以正确输入所有站点。

我的问题是网站上的内部链接(导航等)为我的所有链接添加前缀“sitecore/content/sitename/”。

我已经尝试了几乎所有我能想到的修复/解决方案 - 但没有运气。

有什么想法吗?

I have a Sitecore solution with multiple sites. All sites are setup in SiteDefinition.Config, and i can enter all the sites correctly.

My problem is that the internal links on the sites (navigations etc.) prefixes 'sitecore/content/sitename/' to all my links.

i have tried almost all the fixes/solutions i could think off - but no luck.

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

倾城°AllureLove 2024-09-25 05:07:09

我遇到了类似的问题,但我的问题仅发生在内部站点之间的链接时。我写了 2 篇博客文章(帖子 #1< /a>, 帖子#2)详细介绍了我使用的解决方案。简而言之,它涉及扩展 Sitecore 的 LinkProvider...

I ran into a similar problem however mine only occurred when the links were between internal sites. I wrote 2 blog posts (post #1, post #2) that detail the solution i used. In short, it involves extending Sitecore's LinkProvider...

挽清梦 2024-09-25 05:07:09

您的网站定义是否设置为使用不同的 rootPath 属性值?

<site name="mysite1" rootPath="/sitecore/content/mysite1" startItem="/home" hostName="mysite1.com" ... />
<site name="mysite2" rootPath="/sitecore/content/mysite2" startItem="/home" hostName="mysite2.com" ... />

Are your site definitions setup to use different values for the rootPath attribute?

<site name="mysite1" rootPath="/sitecore/content/mysite1" startItem="/home" hostName="mysite1.com" ... />
<site name="mysite2" rootPath="/sitecore/content/mysite2" startItem="/home" hostName="mysite2.com" ... />
無心 2024-09-25 05:07:09

你的一套吗

<setting name="Rendering.SiteResolving" value="true" />

Is your

<setting name="Rendering.SiteResolving" value="true" />

set?

挖个坑埋了你 2024-09-25 05:07:09

如果你想按照你想要的方式创建链接,你必须使用 LinkManager 配置,然后使用 GetDynamicUrl 方法获取 url。

Sitecore.Links.LinkUrlOptions options = new LinkUrlOptions();
options.Site = "Site1";
string portalUrl = LinkManager.GetItemUrl(Item, options);

希望有帮助。

if you want to create links the way you want you have to use a LinkManager Config and then get url using the GetDynamicUrl method.

Sitecore.Links.LinkUrlOptions options = new LinkUrlOptions();
options.Site = "Site1";
string portalUrl = LinkManager.GetItemUrl(Item, options);

Hope it helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文