English 中文(简体)
Sitecore not resolving rich text editor URLS in page renders
原标题:

We re having issues inserting links into rich text in Sitecore 6.1.0. When a link to a sitecore item is inserted, it is outputted as:

http://domain/~/link.aspx?_id=8A035DC067A64E2CBBE2662F6DB53BC5&_z=z

Rather than the actual resolved url:

http://domain/path/to/page.aspx

This article confirms that this should be resolved in the render pipeline:

in Sitecore 6 it inserts a specially formatted link that contains the Guid of the item you want to link to, then when the item is rendered the special link is replaced with the actual link to the item

The pipeline has the method ShortenLinks added in web.config

<convertToRuntimeHtml>
    <processor type="Sitecore.Pipelines.ConvertToRuntimeHtml.PrepareHtml, Sitecore.Kernel"/>
    <processor type="Sitecore.Pipelines.ConvertToRuntimeHtml.ShortenLinks, Sitecore.Kernel"/>
    <processor type="Sitecore.Pipelines.ConvertToRuntimeHtml.SetImageSizes, Sitecore.Kernel"/>
    <processor type="Sitecore.Pipelines.ConvertToRuntimeHtml.ConvertWebControls, Sitecore.Kernel"/>
    <processor type="Sitecore.Pipelines.ConvertToRuntimeHtml.FixBullets, Sitecore.Kernel"/>
    <processor type="Sitecore.Pipelines.ConvertToRuntimeHtml.FinalizeHtml, Sitecore.Kernel"/>
</convertToRuntimeHtml>

So I really can t see why links are still rendering in ID format rather than as full SEO-tastic urls. Anyone got any clues?

Thanks, Adam

最佳回答

This will be the default behaviour if you are using sc:fld to render field values. This is legacy behaviour left from Sitecore 5 which did not replace the guids in item links.

If you want to use Sitecore 6 s new functionality, you must use sc:field instead

问题回答

If you are dealing with a large amount of code changes to implement FieldRenderer, might be worth to consider using Sitecore.Links.LinkManager.ExpandDynamicLinks(string text, UrlOptions options). It parses links and references to media items that Rich Text field might contain.

I also ran into something similar.. My client was using a sitecore placeholder , that also doesn t render the links properly. As stated by the answers I ended using a field render:

<sc:FieldRenderer runat="server" ID="frBody" FieldName="Body"/>




相关问题
Using PHP to find part of a URL

Take this domain: http://www.?.co.uk/elderly-care-advocacy/mental-capacity-act-advance-medical-directive.html How could i use PHP to find the everything between the first and second slash regardless ...

Domains & Foreward Slash

This is rather difficult to explain so please bear with me. We will be hosting 4 websites on our server and the plan is to have each site sit under its own domain: site-a.com site-b.com sub1.site-b....

Encoding of window.location.hash

Does window.location.hash contain the encoded or decoded representation of the url part? When I open the same url (http://localhost/something/#%C3%BC where %C3%BCtranslates to ü) in Firefox 3.5 and ...

Auth-code with A-Za-z0-9 to use in an URL parameter

As part of a web application I need an auth-code to pass as a URL parameter. I am currently using (in Rails) : Digest::SHA1.hexdigest((object_id + rand(255)).to_s) Which provides long strings like : ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

采用网路服务方法

我撰写了一个网络服务,期望一个参数(所谓的“hlink”)成为一种ur。 在使用网络服务之前,URLEncode 所涉参数(“hlink”)。 然后我打电话......。

热门标签