Posted on 30/04/2020 11:54:28
Hi Anders
The URL provider is not related to the navigation. They are 2 different unrelated things.
By using the new URL providers on pages, you get rid of most -1 issues. Because in the old model all catalogs, groups and products in all languages is in the same index, so if you have the same group and product in more languages or more shops, you get duplicates and get the -1 issue. With the new URL model you attach a URL provider to many different pages and lock them to one language and one shop on that page - and the URLs will be part of that pages URL structure as sub-urls. That will remove most -1 issues. Only if you have 2 groups or products in the same shop in the same parent group, you will have the issue.
When you create the navigation you can use either the old XML navigation or the new Navigation viewmodels. They both use the same navigation settings found on the page properties, navigation dialog - enable ecommerce navigation. Usually, you would have the navigation and URL provider enabled on the same page. If not, your navigation settings will have to point to the page with the URL settings. See dump. This is because the catalog urls are only available on page with the URL provider attached - to avoid duplicate urls.
To use the navigation viewmodel instead of the xml navigation, do something like this:
@{
var navigationSettingsMain = new Dynamicweb.Frontend.Navigation.NavigationSettings()
{
StartLevel = 1,
StopLevel = 3,
ExpandMode = Dynamicweb.Frontend.Navigation.ExpandMode.All
};
NavigationTreeViewModel navigation = GetNavigation(navigationSettingsMain);
@foreach (NavigationTreeNodeViewModel node in navigation.Nodes)
{}
}
Sitemap.xml is running on top of the XMLnavigation no matter what. They require a group has a primary page, groups is included in sitemap and that "include products" is enabled on robots.txt on the website. See my dump2 + 3.
Also find attached a layout template that implements a custom sitemaps.xml implementation that can be manipulated.