Review main Abandoned

61044[WIP][FEATURE] Generate URL slugs from arbitrary DB field

Jonas Eberle CR 0 V 0 Easy +38 −4 updated 02/17/20, 08:44

Commit message

Sanitize field value from PersistedPatternMapper.routeFieldResult if it
is declared as {fieldName|sanitized}

Example config:

        routeFieldPattern: '-(?P<uid>\d+)$'
        routeFieldResult: '{title|sanitized}-{uid}'

Just a proof-of-concept so far.

Open questions:
* |sanitized is just the simplest modifier one can think of. Maybe it
should be extendable where any "|..." would be just a "modifier" that
one could register in the PersistedPatternMapper config? Might be
beneficial to make it more abstract code-wise, too to not overload the
current PersistedPatternMapper code too much. "FieldResultModifiers"
could be a nice API for any on-the-fly transformation of URL parts.
* The current "modifier" (SlugHelper->sanitize) is not even configurable
right now but just uses its standard config. It would be easy to allow
configuring it for each field via PersistedPatternMapper config.
* Maybe the sanitized field should be checked for correctness during
URL-resolving. Due to the awesomeness of EXT:seo a correct canonical tag
is generated, but maybe redirects or 404 are desired in some
circumstances. I don't know if EXT:seo might have a feature "redirect
to canonical" already (?).
* I think cache flooding is not possible but please verify my thinking
here.

TODO:
  * Evaluate if at all and how to implement
  * .rst
  * tests

Review

  • Code review CR 0

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V 0

    Imported before Forger kept the single votes, the next import adds them.

Issues 1

Files 1