6

We have a requirement to override page publish url/path (with some customized url) while publishing the page and commit this new custom path to broker DB, irrespective of the 'directory' value set in the structure group. (i.e.) ignoring the structure group directory value.

To be more specific below is our exact requirement:

If we publish any page from parent structure group or its child structure group(s) of any level ,we want to set the page publish url (path) for all the pages as '\PageFileName.extension' (ex:\Article.html)

Where Root(parent structure group) has its directory value set to blank path ().So we want to ignore the child Structure Group(s) directory field value in the page url when we publish any pages with in them.

Is this functionality any way possible while publishing? Either using .Net Templating (or) Event Handlers(or) Deployer Extension(or)Custom Resolver can we achieve this? If possible please suggest any help is highly appreciated.

I think we can change Page file Name or set binaries publish location using code while publishing and even we can read publish location of page in Templating code but is it possible to change the directory/publish url of the page itself from code while publishing?

Attaching the screenshot with our requirement briefed out Modify Page URL while publishing

3
  • 1
    There seems to be some confusion here between requirements and implementation details. Getting a particular URL into the Broker DB is an implementation detail. Calling this a requirement just confuses the issue, as no doubt there are many other ways to deliver the required functionality. What are you actually trying to achieve here? Commented Apr 11, 2014 at 7:29
  • What would stop somebody from creating a Page called Article.html in Level2 or Level3? It looks to me like your "requirement" can cause a lot of issues if not well managed. SDL Tridion already has an inbuilt solution against duplicate Page filenames in the same Structure Group, which is why the full path of a Page is stored in the Broker, since there is a guarantee that it will be unique. Commented Apr 11, 2014 at 8:35
  • Thankyou all for responses(Sorry for the delay in reply) It looks like from CM side there is no direct way to go,Can we do something in DeployerExtension Pre-Processing/Pre-transaction phases?Can we edit page path url value in transportpackage in any of the (pre)phases of DeployerExtension and send the modified path to BrokerDB? or can we put any sort of trigger on BrokerDB tables?like on any row update/insert in 'Page,Link_Info' tables the trigger can be executed.I know any activities on BrokerDB is not suggested.Please suggest any approach which doesn't effect performance of page render time
    – user1005
    Commented Apr 15, 2014 at 3:19

3 Answers 3

6

In many other systems the URL is only a parameter in the DB and making it 'online' is a boolean flag in the database. However, Tridion is architected in a different way where the publishing lifecycle (and rollback) is well thought out and assumes that your published page 'lives' where it does in the backend.

Overall, it smells like a bad design process and will be the beginning of many challenges. It works against the nature of Tridion, and for that reason, I am against it.

However, I agree with Nick's rewrite URL solution - as it is simply a pointer to your 'real' page with the URL matching Tridion, and doesn't change the nature of the Tridion publishing lifecycle.

Otherwise, I disagree with Nick's brainstormed solutions, since I strongly disagree with tricking Tridion to put the page in the root. For example, what if there already is a page with the same name there? In Tridion, the backend CMS prevents this. But, when you hack this yourself, you have to handle it.

I would strongly suggest to use URL re-writes or discuss the business requirements again and avoid the solution all together.

1
  • Totally agree with you Rob. Putting the page to the root via the Event System is an extreme hack and is a terrible solution. Commented Apr 11, 2014 at 19:54
2

Welcome to the Tridion community and starting off with a great question.

Your requirement is best solved outside of Tridion with URL Rewrite rules. If .NET/IIS then use the URL Rewrite Module: http://www.iis.net/downloads/microsoft/url-rewrite. If Java/Unix then use mod_rewrite (http://httpd.apache.org/docs/current/mod/mod_rewrite.html).

To directly answer your question on whether this is possible to do via Tridion's extension points, yes - but it's hard and in some cases hacky. Here are a couple of ways I can think of from the top of my head:

  1. Implement an Event Handler that on publish of a page, in the Initiated phase, moves the page to the root SG publishes it, then quietly moves it back. This is hacky, but worked in a similar scenario as described here: http://www.tridiondeveloper.com/translating-page-urls-without-localizing-pages. Note, if many Tridion publishers are publishing many pages at the same time, then there may be conflicts.
  2. Implement a custom REL Link Renderer (http://www.tridiondeveloper.com/cleaning-and-extending-dynamic-linking). This works well for Dynamic Component Presentations, and can be used for pages if they are stored in the DB, not the file system. However, make sure to test that you don't break Tridion's Dynamic Linking functionality by overriding too much stuff.

If you start messing around with URLs with a Deployer Extension - or using an officially supported extension point called a Storage Extension, you run the risk of breaking Tridion's Dynamic Linking functionality. Be careful here. mod_rewrite is much easier.

3
  • Nifty solution of moving the Page to the Root SG, but indeed I expect a lot of issues with that like duplicate Page names. I agree that URL rewrites would be the best possible solution! Commented Apr 11, 2014 at 8:31
  • 1
    And you can't move a published page... :(
    – Nuno Linhares
    Commented Apr 11, 2014 at 17:41
  • Good point Nuno. Upon second though, this wouldn't work at all then since you wouldn't be able to move the page back to the original SG since it would be published. Commented Apr 11, 2014 at 19:50
2

Short URLs (and/or Campaign URLs) can be sometimes useful indeed, and some other CMS systems do have that feature if that is where you come from.

I would suggest the following which might be considered in case you need users to set up these URLs (but of course taking longer to do):

  1. Create a Tridion GUI Extension (The link is based on Tridion 2011) in CME, providing a way for users to set up those URL mapping (i.e. Mapping http://domain.com/L1/L2/artcile1.htm to http://domain.com/L2article.htm
  2. TBB to publish this mapping to broker DB or even CD web application file system
  3. A HTTPModule on the web application side to re-write the short URLs to the real full URLs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.