eat-sleep-code
eat-sleep-code

Reputation: 4855

Sitecore 8: SEO URLs

I would like to be able to:

Name items with any or all of the following:

I have added the following two lines to the <encodeNameReplacements> node:

<replace mode="on" find=" " replaceWith="-"/>
<replace mode="on" find="_" replaceWith="-" />

I have updated the to have the following value:

\/:?&quot;&lt;&gt;|[]-_

Do I need to update the <setting name="ItemNameValidation"> too?

What would be the correct regex to use for the above scenario? I tried tinkering with it, and well let's just say something isn't right.

Upvotes: 2

Views: 240

Answers (1)

Martin Davies
Martin Davies

Reputation: 4456

Yes I would update the ItemNameValidation setting. I think this pattern should meet your requirements:

^[A-Za-z0-9 ]+$

It specifies that the string should be composed of one or more of any of the following:

  • A-Z
  • a-z
  • 0-9
  • [Space]

Just in case there's some confusion, encodeNameReplacements is not relevant to item naming. It's for the generation of URL's

Upvotes: 5

Related Questions