Skip to main content
edited tags
Link
Gatogordo
  • 20.3k
  • 2
  • 39
  • 100
added 18 characters in body
Source Link

I have a general link that is linking to an item in Sitecore. 
Path to linked item -->Path to linked item --> /sitecore/content/home/pageItemWithLayout/sitecore/content/home/pageItemWithLayout

I am using the below scriban script below to render the item link.

<a href = "{{i_item.Link.Target}}"  target="_blank">Some item Link </a>      
                                                                                                 

and htmlHTML is rendered

<a href="/sitecore/content/home/pageItemWithLayout" target="_blank">Some item Link </a>

is there a way to access a friendly URL for this Sitecore item in scriban similar to how we can use Sitecore LinkManager Sitecore.Links.LinkManager.GetItemUrl(itempath) to get the friendly url?

The output required after scriban render is

<a href="/pageItemWithLayout" target="_blank">Some item Link </a>

This item could also be present in a microsite as well.

I have a general link that is linking to an item in Sitecore. Path to linked item --> /sitecore/content/home/pageItemWithLayout

I am using below scriban script to render the item link.

<a href = "{{i_item.Link.Target}}"  target="_blank">Some item Link </a>      
                                                                                                 

and html is rendered

<a href="/sitecore/content/home/pageItemWithLayout" target="_blank">Some item Link </a>

is there a way to access a friendly URL for this Sitecore item in scriban similar to how we can use Sitecore LinkManager Sitecore.Links.LinkManager.GetItemUrl(itempath) to get the friendly url?

The output required after scriban render is

<a href="/pageItemWithLayout" target="_blank">Some item Link </a>

This item could also be present in a microsite as well.

I have a general link that is linking to an item in Sitecore. 
Path to linked item --> /sitecore/content/home/pageItemWithLayout

I am using the below scriban script below to render the item link.

<a href = "{{i_item.Link.Target}}"  target="_blank">Some item Link </a>      
                                                                                                 

and HTML is rendered

<a href="/sitecore/content/home/pageItemWithLayout" target="_blank">Some item Link </a>

is there a way to access a friendly URL for this Sitecore item in scriban similar to how we can use Sitecore LinkManager Sitecore.Links.LinkManager.GetItemUrl(itempath) to get the friendly url?

The output required after scriban render is

<a href="/pageItemWithLayout" target="_blank">Some item Link </a>

This item could also be present in a microsite as well.

Source Link
Shaurya
  • 457
  • 2
  • 16

Using Sitecore link Manager in scriban script

I have a general link that is linking to an item in Sitecore. Path to linked item --> /sitecore/content/home/pageItemWithLayout

I am using below scriban script to render the item link.

<a href = "{{i_item.Link.Target}}"  target="_blank">Some item Link </a>      
                                                                                                 

and html is rendered

<a href="/sitecore/content/home/pageItemWithLayout" target="_blank">Some item Link </a>

is there a way to access a friendly URL for this Sitecore item in scriban similar to how we can use Sitecore LinkManager Sitecore.Links.LinkManager.GetItemUrl(itempath) to get the friendly url?

The output required after scriban render is

<a href="/pageItemWithLayout" target="_blank">Some item Link </a>

This item could also be present in a microsite as well.