Copied to clipboard

Flag this post as spam?

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


  • Sébastien Richer 194 posts 430 karma points
    Nov 30, 2013 @ 17:09
    Sébastien Richer
    0

    Umbraco 7 - Underscores in document type alias?

    I'm taking version 7 for a spin and I notice underscores are automatically removed from my document types' alias names when I try to name them like that!

    The thing is that I use a naming scheme like this:

    _Products
        Products
        SomeOtherListingSimilar

    I do this so that my content users don't have to choose a template (because they always choose the wrong one). This way I have 1 document type definition and I can assign my templates like I want.

    Anyone came accross this? Thanks!

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Nov 30, 2013 @ 20:22
    Morten Bock
    0

    I've not seen it, but I can think of a couple of reasons why they might do it.

    First thing is that when doing the examin/lucene search indexing, the convention is that the internal properties are prefixed with an underscore (_id, _path etc etc).

    The other is that the alias is also used as an xml element name in the cache. I'm not sure, but it could be invalid to start an element name with an underscore.

    I hope that at least clears up why it could be happening.

  • Sébastien Richer 194 posts 430 karma points
    Jan 07, 2014 @ 17:35
    Sébastien Richer
    0

    I was looking inthe source, and it seems there might be something wrong, everywhere I look I see that underscore is allowed as an alias character (but maybe not as the first character, but even if I try S_Products it skips the underscore).

    I was looking at "public DefaultShortStringHelper WithDefaultConfig()" in Umbraco-CMS-7.0.2\src\Umbraco.Core\Strings\DefaultShortStringHelper.cs

    }).WithConfig(CleanStringType.Alias, new Config
                {
                    PreFilter = ApplyUrlReplaceCharacters,
                    IsTerm = (c, leading) => leading 
                        ? char.IsLetter(c) // only letters
                        : (char.IsLetterOrDigit(c) || c == '_'), // letter, digit or underscore
                    StringType = CleanStringType.Ascii | CleanStringType.UmbracoCase,
                    BreakTermsOnUpper = false
                });

    Quite odd...

Please Sign in or register to post replies

Write your reply to:

Draft