Umbraco-cms: Umbraco 8 should honour the casing of views as entered by the user and not lowercase the first letter of a View file name

Created on 17 Jul 2019  路  6Comments  路  Source: umbraco/Umbraco-CMS

When I create a new View in Umbraco it makes the first letter of the filename lowercase (it also removes any leading underscores, but that's another matter).

This happens in v8.1 and also happened in earlier v8 versions

Umbraco should create view files using the casing entered by the user

communitpr typbug

All 6 comments

It should be easy to override the name, or configurable to say "partials" for example, all have a leading _
There are more questions around this for me rather than just saying it should respect what is typed as, for example, I still like the convention of _layout for my master template. Then I want my main templates to all start with a capital and my partials to start with an _ and lowercased first letter.

Configuration options for these things would be great imo :-)

As the alias generated by the back office when creating a template or view is camel case, the files that created are too. It feels a little wrong as Visual Studio creates these as pascal case by default.

I鈥檓 pretty sure this is a bug in V8, as in V7 all templates and views had pascal case aliases - unless this is an intentional feature and I鈥檝e missed something?

Should hopefully be moderately easy to fix the alias generation code in the backoffice to make these pascal case by default.

@callumbwhyte You mean the alias is camelCase I assume?

I feel like files should follow Mvc conventions, which means all normal views should be PascalCase and all Partial views should be prefixed with an '_'.

Agree. I found it annoying in 7 they stopped allowing an underscore, but forcing case (especially when it goes against Microsoft conventions) is just plain naughty. Stop it at once.

Because filenames can't contain certain special characters (see Path.GetInvalidFileNameChars()), this is probably why it uses the alias (as that's already sanatized).

Might be better to just remove the special characters from the template name to use as filename, so this also allows the leading underscore.

This has been addressed in #4889 - unmerged as of now, but at least there's a fix 馃槃

Was this page helpful?
0 / 5 - 0 ratings