So, in Umbraco 7 I developed an internal package to have virtual Date Urls using a UrlProvider and ContentFinder. This is no problem to port to Umbraco 8. However, another thing this package did in Umbraco 7 is disabling unique naming for document types with date urls. We found that people will frequently create a identical headlines for news items, for instance for the same event each year. With date urls, this causes no problems, as long as you disable unique names.
In Umbraco 7 I did this by disabling unique names globaly in umbracoSettings.config and then copy-pasting the relevant code from the Umbraco source code and running unique naming for anything that didn't have date urls enabled.
However, in Umbraco 8 this setting has been removed - and obviously all the code related to naming has been rewritten completely.
From looking at the code I think I would be able to create a class inheriting from DocumentRepository, selectively disabling unique naming there and then replacing the built-in DocumentRepository using DI. However, that class is internal, so I'd have to copy-paste everything over, which I'd rather avoid, as I'd have to repeat that every time something is fixed in DocumentRepository.
Any ideas on how to accomplish this in v8?
I can't really see any other way than making DocumentRepository (and other such classes) public so that you can inherit from them without having to copy massive amounts of code. Assuming, of course, that you can replace things like DocumentRepository using DI, which I haven't tried...
I'm also looking for a solution to allow duplicate names for newsitems. In Umbraco 7 we used the node id in de url in combination with a custom contentfinder.
Did you find a solution to enabled duplicate names in Umbraco 8?
Disabling Unique Naming in Umbraco 8
So, in Umbraco 7 I developed an internal package to have virtual Date Urls using a UrlProvider and ContentFinder. This is no problem to port to Umbraco 8. However, another thing this package did in Umbraco 7 is disabling unique naming for document types with date urls. We found that people will frequently create a identical headlines for news items, for instance for the same event each year. With date urls, this causes no problems, as long as you disable unique names.
In Umbraco 7 I did this by disabling unique names globaly in umbracoSettings.config and then copy-pasting the relevant code from the Umbraco source code and running unique naming for anything that didn't have date urls enabled.
However, in Umbraco 8 this setting has been removed - and obviously all the code related to naming has been rewritten completely. From looking at the code I think I would be able to create a class inheriting from DocumentRepository, selectively disabling unique naming there and then replacing the built-in DocumentRepository using DI. However, that class is internal, so I'd have to copy-paste everything over, which I'd rather avoid, as I'd have to repeat that every time something is fixed in DocumentRepository.
Any ideas on how to accomplish this in v8?
I can't really see any other way than making DocumentRepository (and other such classes) public so that you can inherit from them without having to copy massive amounts of code. Assuming, of course, that you can replace things like DocumentRepository using DI, which I haven't tried...
Hi Asbjørn,
I'm also looking for a solution to allow duplicate names for newsitems. In Umbraco 7 we used the node id in de url in combination with a custom contentfinder.
Did you find a solution to enabled duplicate names in Umbraco 8?
Best regards,
iNETZO
is working on a reply...