1

I have a component. This component have Body field. This body field have following anchor tag:

<a href="tcm:23-20253-64"> </a> 

This anchor tag have a page tcm Id but after publish this tcm does not resolve in proper url.

Can you please explain how can I fix this?

3

Links to other Tridion items must be "managed", i.e., they have to be identified to Tridion as an xlink object rather than just an href. If you look at how Tridion Component Links are created in a rich text field, you'll see that they're stored as:

<a xlink:href="tcm:123-132">Some text</a>

Tridion then has enough information to convert this to a dynamic link.

There are quite a few constraints about which items you can link to, the most important ones being:

  • You can only link to other components (or keywords, but that's a different use case)
  • You can only link to other items in the same publication

This means that if you try to store a page link using the above convention, something like this:

<a xlink:href="tcm:123-22-64">some text</a>

Tridion will not allow it, because it fails validation of constraints shown above.

The correct way to do linking in Tridion is to point to the content that you want to link to, and ignore the container (the page). Tridion will make sure the link points to a page that contains the content you're linking to.

If you really really really absolutely 100% must link to a page, then you should consider the usage of dummy components that exist only in one page and have no real output. These could be used as pointers to those pages.

But do keep in mind why linking works this way: authors should link to content, not to pages. You want to drive your visitors to go a certain piece of content, not to a specific page whose content may change regularly.

Using Component Linking will also make your editors lives incredibly simple if they need to re-arrange the site structure (which does tend to happen more regularly than people think it will).

| improve this answer | |
  • i want page linking because in my html there is anchor tag "a href=a/b/abc.html" and i have a "abc.html" page and it's tcm ID is "tcm:23-20253-64" i want when i click this anchor then "abc.html" page should be displayed – pankaj Sharma Mar 28 '14 at 12:31
  • Tridion does not allow an editor to store a page link in a rich text field - only component links. The challenge is not really linking to the page, it's linking to the page in the correct publication. Component linking is the only option for editors. – Nuno Linhares Mar 28 '14 at 14:55
  • Ok Nuno but i have three component on abc.html page like component1,component2,component3 then which component linking I should give in order to show full abc.html. – pankaj Sharma Mar 31 '14 at 6:13
  • Any of them will work - the resolving logic is explained in detail here: sdllivecontent.sdl.com/LiveContent/content/en-US/… (login required). In theory, you should point to the component that contains the "main content" of abc.html – Nuno Linhares Mar 31 '14 at 10:42
1

Try using tridion:href as below

<a href="" tridion:href="tcm:23-20253-64" title="" target="_blank">
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.