SaaS CMS has officially launched! Learn more now.

Get the containing page URL on block content publish


I've tried to use info from this blog
to collect info about containg page for the block being published, but this works only when it gets to the rendering point.

Is there a way of getting the URL of containing page of the block being published if the block is actually contained in the content area?

Oct 20, 2016 11:05

What about this (code from Dejan's answer)?

var linkRepository = ServiceLocator.Current.GetInstance<ContentSoftLinkRepository>();
var blockLink = (currentBlock as IContent).ContentLink;
var referencingContentLinks = linkRepository.Load(blockLink, true)
                                            .Where(link =>
                                                    link.SoftLinkType == ReferenceType.PageLinkReference &&
                                            .Select(link => link.OwnerContentLink)
Oct 20, 2016 15:37
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.