November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Don't think there is a function to get the permanent link. But you can easily create one on your own with following format: /link/{content guid}. The content guid is available on all content items.
Hi Johan
I am not sure creating such link for media files (pdf) will take me to the actual content. I tried your suggestion but I get 404. Am i missing something ?
It should work. Maybe the format of the guid is important(?)
var permanentLink = $"/link/{content.ContentGuid:N}";
Thanks Johan. It was my mistake as I was appending .pdf to the link whereas it should be either .aspx or nothing at all. Also yes the format of guid is important as it should not contain the "-".
I would add here that don't forget the EPiServer.Web.PermanentLinkUtility from EPiServer assembly ;) as it has the method for you that does exactly what the suggested format string from Johan (well with a little twist :D)
string permanentLinkUrl = PermanentLinkUtility.GetPermanentLinkVirtualPath(your-content-here.ContentGuid, ".aspx");
The last argument is the extension you want to have for the created url (and it must include the dot), but if you leave it as null or string empty you will get the "extensionless" url.
Is there a property that is equivalent to LinkUrl for PageData. The need I have is to provide a constant URL (Permalink) to pdf files so even if they were moved from one directory to other in Media, there is still a link that takes me to the PDF.
Converting a media file to Icontent doesn't have the LinkUrl.