Web2Cit/Docs/Patterns
URL path patterns define separate translation subgroups within a website/domain based on the path of target webpages. This is used to more strictly and explicitly state which translation templates should be used to translate which target webpages. You may think of them as a way to have isolated translation template configuration environments within a domain.
As described in the Basics documentation page, when a target webpage is requested to be translated, Web2Cit tries to match its path to one of the URL path patterns defined for the domain that it belongs to, and then uses translation templates based on webpages/paths sorted into the same pattern to return a translation.
If no matching URL path pattern is found, a catch-all translation subgroup is used instead.
Pattern definition
[edit]URL path patterns are defined using glob patterns.
In addition, URL path patterns may include a label to help Web2Cit collaborators understand why they have been added.
Pattern matching
[edit]Targets and templates are sorted into the first URL path pattern group that matches the corresponding path. URL path pattern groups are tried in the order in which they are defined in the domain's patterns configuration file.
There are tools to test your glob patterns. See for example DigitalOcean's Glob Tool. However, note that there may be differences between specific implementations. The Web2Cit core library currently uses the glob matcher for JavaScript minimatch, with option dot: true to match path segments beginning with dot (see T322875).
Note that URL query string and fragment (i.e., the parts of a URL beginning with a question mark ? or a hash #, respectively) are excluded from URL path pattern matching. If controlling which translation templates should be used to translate a target webpage based on these URL query string parameters, consider using the Control template field and the URL selection step; see the Templates documentation for further information.
Catch-all pattern
[edit]If no URL path pattern is found that matches the target webpage's path provided, Web2Cit sorts it into the translation subgroup defined by the ** catch-all glob pattern.