Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Asbjørn 75 posts 182 karma points c-trib
    Jul 29, 2019 @ 06:31

    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...

  • iNETZO 93 posts 412 karma points
    Oct 30, 2019 @ 15:04

    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,


Please Sign in or register to post replies

Write your reply to: