Can't use more than 1 field in urlmap

16 views
Skip to first unread message

aDNers

unread,
Nov 2, 2017, 8:06:01 AM11/2/17
to dotCMS User Group
Hello hello,

I experience a wierd thing with the urlmaps. 

The url map: /guides/{articleId}/{articleId} 
gives the following expected generated urlTitle:

/guides/{urlTitle}/{articleId} 
instead gives the following urlTitle:

Not sure why I can't use more than one "field variable" in the urlmap. 

Anyone experienced this before?

Nathan Keiter

unread,
Nov 2, 2017, 8:46:06 AM11/2/17
to dot...@googlegroups.com

I think it’s more that you are using the same field twice, rather than two fields. Perhaps in the underlying code it’s doing a replace instead of a replaceAll?

 

I think using a unique identifier twice to show content is not the intended function. Why do you need to send two unique ids?

 

Nathan I. Keiter | Lead Network Applications Programmer | Benefits Advisory Council Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993

https://www.gettysburg.edu

--
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+un...@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/1defe996-6a36-40fb-b68a-d6be1010adc0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

aDNers

unread,
Nov 2, 2017, 9:13:19 AM11/2/17
to dotCMS User Group
Hi,

In my usecase I don't want to use the same field twice, I want to use 2 separate fields. But when I use 2 different fields only the first one is rendered. My original example just showed that using the same field twice rendered the generated fieldcontent twice. (The reason for me wanting to use 2 different fields is that in our migration from our old CMS I have a path saved in a field (something like: cars/sportcar) and I want to build the urlmap as: /guides/{urlPath}/{urlTitle} but now only the urlPath is rendered.) Sorry for not being totally clear about the issue from the beginning. 

In the screenshots below I did the same operation on the default News-type, for some reasons the {byline} is not being generated. If I witch order of {urlTitle} and {byline} the urlTitle is not generated. 

As stated in the example to the left, you should be able to use two fields, in that case - {productType} and {urlTitle} - however it doesn't seem to work for me.. 

Jason Tesser

unread,
Nov 2, 2017, 9:20:14 AM11/2/17
to dot...@googlegroups.com
Can you also send a screeshot of your Content Type Fields 


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



3059 Grand Avenue
Suite 410-B
Miami FL 33133
Main: 
305-900-2001 | Direct: 978.294.9429

Nathan Keiter

unread,
Nov 2, 2017, 9:20:56 AM11/2/17
to dot...@googlegroups.com

Perhaps a bug then… what version you are on would probably be helpful to someone who can help.

Jason Smith

unread,
Nov 2, 2017, 9:21:47 AM11/2/17
to dot...@googlegroups.com
make sure on your Byline field in the content type you checked index on that field.

On Thu, Nov 2, 2017 at 9:13 AM aDNers <and...@smartson.se> wrote:

Will Ezell

unread,
Nov 2, 2017, 9:23:45 AM11/2/17
to dot...@googlegroups.com
That looks like an issue with the javascript that tries to auto generate the urlmap rather than the urlmap itself.  It looks like you could edit the javascript in the custom field and fix the issue.

aDNers

unread,
Nov 2, 2017, 10:13:04 AM11/2/17
to dotCMS User Group
Hi,

Thanks for all answers. I will check if I can fix the javascript in order to solve my issue. I use the javascript from /application/vtl/custom-fields/url-title.vtl
Jason: you could check the default media type "news" from the dotcms starter page. I have not made any changes to it, and it seems as the byline was indeed indexed, however ... not sure I want to say this, I am currently using version 4.3 nightly build ;-D (maybe I should have tested this on a released version instead before asking in the forum.)

Also, we might have thought of a workaround for this using regexp redirects with vanityurls instead..

If I am the only one experience this, it must be something local but thanks for all suggestions.

Jason Tesser

unread,
Nov 2, 2017, 10:28:31 AM11/2/17
to dot...@googlegroups.com
So yea for sure then edit this VTL #dotParse('/application/vtl/custom-fields/url-title.vtl')
That is the custom field. It is really an example for displaying the URL title. 
It doesn't effect the URL Map from resolving which is important to mention. It is just a handy display of what it will resolve at nothing to do with functionality FWIW 

--
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+un...@googlegroups.com.
To post to this group, send email to dot...@googlegroups.com.

boden...@gmail.com

unread,
Nov 24, 2017, 8:46:19 AM11/24/17
to dotCMS User Group
Just thought I should post how we updated the urltitle.vtl incase anyone wonders. The default vtl
#dotParse('/application/vtl/custom-fields/url-title.vtl')

has a section at the bottom:
for(i=0;i<matches.length;i++){
var val = dojo.byId(matches[0]).value;
console.log(matches[0]);
console.log(val);
urlMap  =urlMap.replace("{"+matches[0]+"}", val);
}

which clearly takes the first index position [0], so just changing [0] to [i] solved a lot.

Thanks,
Anders
Reply all
Reply to author
Forward
0 new messages