From version 4.2
edited by Simon Urli
on 2020/01/14 16:03
To version 5.1
edited by Simon Urli
on 2020/01/14 16:31
Change comment: There is no comment for this version



... ... @@ -7,7 +7,54 @@
7 7  image:name-strategy-configuration.png
8 8  {{/gallery}}
9 9  
10 +The Name Strategies can be configured from the [[Administration Application>>Extension.Administration Application]], on the Editing tab.
10 10  
12 +== Current Naming Strategy ==
11 11  
12 -= Name Strategy Component =
14 +You can select there which name strategy you want to use for the whole wiki.
15 +The different strategies available in XWiki are detailed in [[the dedicated section>>||anchor="HExistingStrategies"]].
16 +Note that if you don't want to use any strategy, you can just disable the two following values to not use transformation or validation.
17 +By default the [[Character Replacement Strategy>>||anchor="HCharacterReplacementStrategy"]] is selected.
13 13  
19 +== Transform Names Automatically ==
20 +
21 +This option allows you to automatically transform the page names before they are created, in order to comply with the selected strategy.
22 +Note that only the page names will be transformed: the page titles will remain untouched.
23 +By default this option is enabled.
24 +
25 +== Validate Names Before Saving ==
26 +
27 +This option allows you to automatically validate a page name when it is created: if the page is not valid, the user will get an error and will be asked to use another name.
28 +Note that this concerns the whole path of the page: not only its name, but also the name of its parents.
29 +This validation check is only perform when creating new pages, so even if you enable it you should be able to edit existing documents that don't comply with the naming strategy.
30 +Nevertheless, this feature is still experimental, so it is disabled by default.
31 +
32 +== Test the Strategy you selected ==
33 +
34 +This text input allows you to type any text to check how the name strategy will behave: it will show you if a potential name is valid or not with the currently selected strategy, and how the strategy would transform the names. You don't need to save for performing the tests, so you can easily change the strategy and validate it before saving.
35 +
36 += Existing Strategies =
37 +
38 +== Character Replacement Strategy ==
39 +
40 +This strategy allows you to define characters that are forbidden in a page name, and how to replace them.
41 +For each forbidden character you define, you can specify a specific replacement character. Or you can chose to not specify a replacement character and in that case, forbidden cases will be just removed.
42 +
43 +This strategy is selected by default, with "/" (slash) and "\" (backslash) as forbidden characters, without replacements defined for them.
44 +
45 +== Slug Name Strategy ==
46 +
47 +This strategy will normalize your page names to remove any special characters: only the latin alphabet (26 letters) without accents, the numbers and the character "-" (dash) are accepted. The accents are automatically transformed to the closest latin letter, and all other special characters are transformed to dashes, with some clean up to avoid redundant dashes.
48 +
49 += Name Strategy Script Service =
50 +
51 +A script service is available to use name strategy components. It can be accessed with {{code}}$services.namestrategies{{/code}}.
52 +You can check the API directly [[on the source>>]].
53 +
54 += Create a Name Strategy Component =
55 +
56 +A new strategy component can be created by implementing the {{code}}EntityReferenceNameStrategy{{/code}} Java class.
57 +A strategy is defined by transformation and validation methods, for both Strings and for EntityReferences.
58 +
59 +Note that you can extend {{code}}AbstractEntityReferenceNameStrategy{{/code}} to only define the transformation and validation methods for Strings and reuse them for the EntityReferences, it's an easier way to define a strategy.
60 +

Get Connected