Getting URL of published element in SDL Tridion

1.7k views Asked by At

Is there any way of finding the absolute URL for a published object in the SDL Tridion Interface?

For example when I published a page, how can I find the url where to access the page?

5

There are 5 answers

0
Quirijn On BEST ANSWER

It is not very straightforward, mostly because Tridion allows you to publish a single page to multiple targets (= web sites). The page could in fact have a number of URLs.

However, the best option is to open the page and click on the Info tab. There you will find the File Path, which might look like this: \about\press\2011. Replace the backslashes with slashes, and add the page's filename and file extension (can be found on the General tab). Put the whole thing behind the root URL of your web site (e.g. http://www.mysite.com').

0
Frank van Puffelen On

Tridion exposes the path of the URL in PublishLocationUrl property. You can access this either through the TOM.NET API or by viewing the raw XML of the item by entering the TCMURI in the address bar of Internet Explorer (e.g. tcm:4-264-64).

But in either case those will just return the path part of the URL. You'll have to prefix it with the correct base URL as Quirijn already mentioned earlier.

0
Dominic Cronin On

In the past, I have resorted to extending the protocol schemas for publication target destinations. Having added a baseURL property there, I could access this from events system code (the idea was to mail a link to a workflow approver). These days, you could use application data to do the same thing.

0
Nuno Linhares On

Though not finished, and not really very documented, the Tridion 2011 PowerTools includes 2 buttons to "Open in Staging" and "Open in Live".

0
johnwinter On

If you're looking for the code in your c# tbb library you can use the PublishLocationUrl property for pages and structure groups:

StructureGroup.PublishLocationUrl or Page.PublishLocationUrl

This will return the URL if the item is published or not, as Page and StructureGroup extend the ReposityObject class, I typically perform a check to see if the ReposityObject is published to the target that the Page is being published to for example:

if (PublishEngine.IsPublished(myReposityObject, myEngine.PublishingContext.PublicationTarget))
{
 // page or sg is published!
}

Note: Where the myEngine is an instance of the Engine object.

If you're doing this in the core service, that's a little different, what you need to do is create a PublishLocationInfo object which is casted from your Page or StructureGroup object property LocationInfo, as shown below:

PublishLocationInfo pubInfo = (PublishLocationInfo)page.LocationInfo;
return pubInfo.PublishLocationUrl;