Linking to Data Items

Link to blog posts or news items the same way as you link to pages and media files

When editing a page in Visual Editor, you can insert a link to a page or a media file as well as insert an image.

If you switch to the Source view in the editor, you will see that the links have the following format ~/<type reference>(<data key value>):

  • ~/page(966c26d4-4429-48c2-9f9e-3144def1f63b)
  • ~/media(0712b17a-cf9c-4294-bc7f-b17a03b1b363)

For example:

<a href="/page(966c26d4-4429-48c2-9f9e-3144def1f63b)">view the page</a>
<a href="/media(0712b17a-cf9c-4294-bc7f-b17a03b1b363)">download the file</a>
<img src="/media(0f33c953-1789-4695-8194-55bdc0b4f57b)"/>

When you view the published version of the page in a browser, all these links resolved into standard public URLs:

  • http://contoso.com/My-Page
  • http://contoso.com/media/0712b17a-cf9c-4294-bc7f-b17a03b1b363/6BZK3A/my-image.jpg

Linking to data items

In C1 CMS version 5.0 or later, you can likewise link to individual data items and have them resolved into public URLs on published pages.

For example, a blog post (Composite.Community.Blog), news items (Composite.News) or a product description can now be linked to internally in the editor and accessed publicly on the website.

<a href="~/blog(87ea3c1e-bcd9-4c01-8c91-9eb338bde911)">view the blog post</a>
<a href="~/news(37538218-f1b2-45bb-8ee1-c0d8d64ddf7b)">view the news</a>
<a href="~/product(4709d7ed-5b88-4df1-8070-80e67b5476f6)">view the product's detailed info</a>

To enable linking to data items of a certain type, you need to:

  1. Define the data link's internal format (e.g. ~/blog() for blog posts).
  2. Have these internal links resolved into public URLs.