Different URLmaps for same content with constant canonical

16 views
Skip to first unread message

aDNers

unread,
Aug 28, 2017, 4:01:39 AM8/28/17
to dotCMS User Group
Hello,

Still somewhat new to dotCMS and trying to figure out how to setup the detail pages/url maps for this scenario:

Each content of a custom type "product test" will have 3 different phases. We can call them Phase1, Phase2, Phase3. A content editor will have to change a dropdown and select which phase that is currently active. The URL should then be built something like: http://domain.com/{phase}/urltitle

The canonical URL should reflect the phase which is selected in the dropdown. However, all three possible urls should be working active links at all times, that is:
 
1) http://domain.com/phase1/urltitle
2) http://domain.com/phase2/urltitle
3) http://domain.com/phase3/urltitle

I wonder if this would be possible using dotCMS, and if so - any guidance on how to approach this would be much appreciated.

(I discovered there is only room for 1 detail page per contentlet and started to wonder if I could build different pages for the different phases of a content but I don't think it is a solution to build Pages where the editor needs to manually pull content.)

BR
Anders

Xander Steinmann

unread,
Aug 28, 2017, 4:14:37 AM8/28/17
to dotCMS User Group
Hi Anders,

You can use a wildcard/regex in the detail URL, for instance /.*/{urltitle} or /phase[123]/{urltitle}. On the detail page you can check the URL ($request.getRequestURI()) for the phase and display something else based on that. That's the easiest way.
An alternative is a plugin with a servlet / service / filter on the URL and redirect/include a page based on the URL.

Kind regards,

Xander 

Op maandag 28 augustus 2017 10:01:39 UTC+2 schreef aDNers:

aDNers

unread,
Aug 28, 2017, 4:21:07 AM8/28/17
to dotCMS User Group
Hi,

Thanks alot, I didn't know about the wildcard option. Will play around with that! :)

Mark Pitely

unread,
Aug 28, 2017, 10:26:24 AM8/28/17
to dot...@googlegroups.com
You can also use two variables in the url for the same structure; if your content has a 'phase' text/integer variable, you can use /{phase}/{title}
The url variables that are passed are essentially used as a query to find the specific content.
It depends on how much is changing between each phase and whether the p1 and p2 items can share the same structure.

Mark Pitely
Marywood University

On Mon, Aug 28, 2017 at 4:21 AM, aDNers <and...@smartson.se> wrote:
Hi,

Thanks alot, I didn't know about the wildcard option. Will play around with that! :)

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+unsubscribe@googlegroups.com.
To post to this group, send email to dot...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/b0551a05-6146-4cce-b7ad-24462b96d809%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Xander Steinmann

unread,
Aug 28, 2017, 10:32:57 AM8/28/17
to dotCMS User Group
Hi Mark,

In your case you need 3 pieces of content, one for each phase. Otherwise the phase1 link will not work when the content is set to phase2.
Now that I think about it, it is not really logical to put the phase in the URL when all phases end up displaying the same content...

Kind regards,

Xander

Mark Pitely

unread,
Aug 28, 2017, 10:40:03 AM8/28/17
to dot...@googlegroups.com
Yes; you are correct. It depends on whether he needs specific content for each. If the phases are really just a ' time switch', that really shouldn't be handled via URL.
I mean, there has to be something different between phase1, 2 and 3 *content* otherwise I don't understand his question.
His one detail page could have that logic built into it. I.e. display on it 'This item is in Phase 1' if the item is set to 1, but all use the same URL.


M

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+unsubscribe@googlegroups.com.
To post to this group, send email to dot...@googlegroups.com.

aDNers

unread,
Aug 28, 2017, 4:33:03 PM8/28/17
to dotCMS User Group
Hello again ☺️
I was indeed able to use the wildcard match to solve my problem. Worked as expected 👍

Content is changed between each phase, but we need to have all 3 urls working at all times, redirecting to the active phase when the old one expires. The link to the pages ends up on lots of different places. (Which is also why it is important for us to have the canonical link in order.)

Just to explain:
Phase1 = application phase. Page includes a application survey.
Phase2 = test phase. Page includes blogs, posts from people taking part of the activity which they applied for in the first phase.
Phase3 = result phase.

(You can check how it works on smartson.se (Although in swedish). We are currently in the process of a cms migration and one request which ended up on my table was to reflect each phase also in the URL, moving forward.) Thanks for the ideas and follow up discussion.
Reply all
Reply to author
Forward
0 new messages