Developer forum

Forum » CMS - Standard features » URL Generation

URL Generation

Scott Forsyth Dynamicweb Employee
Scott Forsyth
Reply

I have a couple questions about URL generation. 

Are there any levers to control the URLs that are generated? I believe that it's generated at runtime and can't be overwritten, but I'm hopeful that there's something that I'm not aware of. Also, are the URLs persisted to the database anywhere or are they always determined fresh each time the site starts?

Or, maybe another question, are there any docs on how the URLs are determined?

We're running into issues with two URLs with the same name, like abc.com/products and abc.com/products-1. How can we determine which page gets the products and which gets products-1?

Also, we thought we had a clever trick that may have just come to hurt us. We had a group structure backed by ecom, and we created content pages with the exact same URL. This enables us to have rich content pages that overrode some of the ecom pages sometimes, while just using the standard ecom structure the rest of the time. (e.g. /products/docks has lots of marketing material, but /products/docks/accessories is just a standard product catalog type page, but both of them are in the ecom product catalog, but only /products/docks is in the Content section.)  This seemed to work well, but now all of a sudden a new products page has appeared, creating a /products and /products-1. So it appears that our trick wasn't a safe one.

Are there any docs or instructions on this?

Thanks,

Scott


Replies

 
Scott Forsyth Dynamicweb Employee
Scott Forsyth
Reply

Any ideas on this? I have a pretty pressing need to figure out the URL generation. Where should I go to get started? We have some products-1, products-2 type situations and need to figure out how to prioritize them and ensure that they are set correctly and consistently. The content pages are ok, but it's the ecom group URLs that I would like more insight into.

Thanks,

Scott

 
Nicolai Pedersen
Reply

Hi Scott.

No ideas. Generally using pages for ecommerce structures is usually a bad idea - instead I would recommend using custom group fields to add 'rich' information for group pages. Alternatively use regular pages as you already did and then only list products on those pages and not use product lists and group navigation at all. Mixing is very difficult to control.

There are basically 2 url indexes in Dynamicweb - one for pages and one for ecommerce groups/products/variants.

To solve the abc.com/products and abc.com/products-1 issue - use settings in Customized URLs section in Settings to create a seperate url index per website. That requires 2 domains/hosts in order to work. If you have only one domain, you have to use 2 different names - otherwise the system cannot tell the difference. See https://doc.dynamicweb.com/documentation-9/platform/platform-tools/customized-urls#3512 You can use the URL field on a page to override the name used in url. See https://doc.dynamicweb.com/documentation-9/content/content/pages#3239

For group structures, there is not much you can do. There is one index for all catalogs and languages, so if you have 2 or more groups in the root of any shops with the same name, they will be named xxx-1 etc. Names HAVE to be unique in the root - and paths also have to be unique if using full path in URL. URLs are not recorded to database.

You can use showurls=true and showurlindex=true to see ecommerce urls and page urls in the frontend. They only show the first 1000 or so URLs though.

BR Nicolai

 
Scott Forsyth Dynamicweb Employee
Scott Forsyth
Reply

Thanks Nicolai. This is really helpful, especially the querystring parameters. I did some looking and here's what I found:

  • We do need to use content pages for the ecom landing pages because they are made up of many rich paragraphs with a nice responsive design and such. But, I've found that that wasn't the issue. 
  • The issue with the products-1 and products-2 turned out to be because we have duplicate group names in the tree structure. They do have a different full path though. For example:
    • abc.com/products/something/widgets
    • abc.com/products/otherthing/widgets-1
      • This 2nd one lost the URL generation fight and got the -1. However, they are in different paths so they don't need to have unique names for the last part. Is there a way to change that for ecom groups?

Thanks,

Scott

 

 
Nicolai Pedersen
Reply

Hi Scott

Ok, great. That should work. Just tested that using Rapido - looks like the attached. You have the same setup?

A couple of things to look for:

Given your example

  • abc.com/products/something/widgets

Products = Page
Something = Group (If this is a page, this could be the problem)
widgets = Group

Also if you look at my dump #4 below, that is the setting you want.

The last thing that can be wrong is that you have 2 languages with the same names in the structure - that would also give you duplicate url structures.

BR Nicolai

Capture.PNG Capture1.PNG Capture2.PNG Capture3.PNG
 
Scott Forsyth Dynamicweb Employee
Scott Forsyth
Reply

I just realized that it's only the 3rd level group that is doing this. The other groups are fine. I do have the settings that you have, and there is only one language on this site. Your example sounds like the same situation as my setup.

I guess I can post the URLs here in the forum. They won't always work since it's a dev site URL.

Here are two folders with the same name, but one of them gets the -1. Note that 'docks' doesn't do it though.

  • https://qa-walleye.dw-demo2.com/parts-components/docks/roll-a-dock-1 
  • https://qa-walleye.dw-demo2.com/products/docks/roll-a-dock

The group page is working well, but, if you're curious, here it is (images will be added soon):

  • https://qa-walleye.dw-demo2.com/products/docks

Scott

 

 
Nicolai Pedersen
Reply

Hi Scott

Tuff one! Seems like you have the same group twice in the database with a parent with same name:

SELECT * FROM ecomgroups where groupid='L3-2.1.10' or groupid='L3-1.1.10'

I did not look into relation tables - but the data is not shown in the catalog tree, so maybe they are not attached to the shop??

Could this be the cause?

BR Nicolai

 
Scott Forsyth Dynamicweb Employee
Scott Forsyth
Reply

Hi Nicolai,

That's really helpful, and that appears to be it. And that helped me fully figure out what's happening.

It's not necessarily that the group assignment is duplicated to another group, but that the groups are in two shops. So I could use your guidance on that then.

First, here's the issue. 

SELECT g1.GroupID, g1.GroupName, g2.GroupID, g2.GroupName, g3.GroupID, g3.GroupName FROM ecomgroups g3
join EcomGroupRelations r3 on g3.GroupID = r3.GroupRelationsGroupID
join EcomGroups g2 on r3.GroupRelationsParentID = g2.GroupID
join EcomGroupRelations r2 on g2.GroupID = r2.GroupRelationsGroupID
join EcomGroups g1 on r2.GroupRelationsParentID = g1.GroupID
where g3.groupid='L3-2.1.10' or g3.groupid='L3-1.1.10'
 
I don't believe this will work in the SQL firehose, but I've uploaded an image of the results. So there is a duplicate group name, but it has a unique path down the tree. So that part is actually ok.
 
But the issue is that the groups are in two shops: Ecom + PIM.
 
We did that because we wanted to have just one common group structure so that we can use the PIM while having the group structure backed by the ERP. So the same structure is meant to exist in both shops. I've found that it's hit or miss on which group comes first. The problems occur when the URL is generated. When we first set this up, it somehow made the ecom group the primary one, and everything was happy. But when we deployed to the QA environment, some of the groups appeared to consider the PIM the primary group. We had to change the Customized URLs to not "404 for products not in website shop" to get around that. It was still a todo of mine to figure out a better solution, and it looks like this other issue ended up being from the same issue.
 
So, my question now is what is the best solution for that. I see two methods: 1) this method which is one group structure belonging to two shops, or 2) duplicate the group structure for each shop.
 
It sounds like #1 is probably not supposed to be the right solution. Would you agree, and is your advice to do #2, or is there another recommendation for this ecom+PIM group structure?
 
Thanks,
 
Scott
 
groupids.png
 
Scott Forsyth Dynamicweb Employee
Scott Forsyth
Reply

Hi Nicolai,

Just a heads up that while working on another part of this, I bumped into another issue with the #1 option above. So I've started to move to the #2 method. We'll create a copy of the whole ecomgroup tree rather than assigning the one tree to two shops.

If you have a better best practice recommendation, I'll be curious to hear, but otherwise, it's set in motion now to change this. I believe it will address a few issues.

Scott

 

 
Nicolai Pedersen
Reply

Hi Scott

Ah - thank you for explaining. I just found the duplicate paths in the URL index.

See attachment for the reason of the duplicate paths. The Docks group has been marked to leave out its parent in URL generation causing it have the same path...

BR Nicolai

 

Capture.PNG
 
Scott Forsyth Dynamicweb Employee
Scott Forsyth
Reply

Hi Nicolai,

Interesting. I think you're right, but I'm surprised about that. 

The paths are still unique:

  • /parts-components/docks/roll-a-dock-1 
  • /products/docks/roll-a-dock

They are subfolders of docks, so they still have a unique FQDN.

We are ignoring the parent group URL. That's so that we don't get a /products/products in the URL. But, shouldn't that be ok?

I did a full cleanup of the data in the dev site (different URL: https://dev-walleye.dw-demo.com/parts-components/docks/marinas-3) and now the Ecom and PIM groups are completely separated. But it didn't resolve the issue. So I bet that you're right that it's because of that setting. In fact, I tested and confirmed that you're right. But, if I turn off that setting, the URLs look like this:

https://dev-walleye.dw-demo.com/parts-components/parts-and-components/docks/marinas

That's an age old battle that we've had. Is there a better way to have a good organized structure in Ecom without the duplicate shop + group in the URL?

Feel free to test on the dev site, and thanks for your help with this.

Scott

 

 

 
Nicolai Pedersen
Reply

Hi Scott

Thanks for the explanation. And yes I fully understand. We are currently working on a replacement for Ecommerce URLs provider that can use multiple url indexes based on website (and hence domain) to tell the multiple, but similar, group paths apart.

My only solution right here and now is to ensure uniqueness using the "URL" field on the group properties - and add something unique on the root groups in your PIM catalog as that would generate URLs for the PIM catalog that are unique and leave the main catalog URLs to win the battle of the prettiest URL.

BR Nicolai

 
Scott Forsyth Dynamicweb Employee
Scott Forsyth
Reply

Hi Nicolai,

Thanks. Now I understand the details on this so I can focus on the right part. I'll see what we can do with the group properties and making sure that everything is unique enough to keep it happy.

Thanks again.

Scott

 

 

You must be logged in to post in the forum