Route enhancers 

This extension ships route enhancers for the Partner List and the Partner Map in Configuration/Routes/List.yaml. They turn the category filter, the sorting and the page of a list into path segments in the language of the site:

/partners/filter/europe-1,university-3/title/desc/page-2
/de/partner/filter/europa-1,universitaet-3/titel/absteigend/seite-2
Copied!

TYPO3 does not read the file on its own. A site imports it, and nothing changes for a site that does not.

Importing it into a site configuration 

Add the file to the imports of the site that shows the plugins, and limit each enhancer to the pages that carry its plugin:

config/sites/my_site/config.yaml
imports:
  - resource: 'EXT:academic_partners/Configuration/Routes/List.yaml'

routeEnhancers:
  AcademicPartnersList:
    limitToPages: [12]
  AcademicPartnersMap:
    limitToPages: [13]
Copied!

TYPO3 offers every enhancer of a site to every page unless it carries limitToPages , and the first route whose path matches wins. The uids are those of the pages in the default language, one entry covers every translation of a page.

A site that wrote its own enhancer for one of the two plugins removes it when it imports this file. Two enhancers for one plugin compete for the same URLs.

What the URLs look like 

A list URL carries up to three arguments, in this order:

Argument English German
Category filter /filter/europe-1,university-3 /filter/europa-1,universitaet-3
Sorting /title/desc /titel/absteigend
Page, list only /page-2 /seite-2

Each combination of them is a route of its own, so a filter alone, a sorting alone or a page alone resolves as well as all three together. The map is not paginated and has filter and sorting only.

  • The filter is mapped by the CategoryFilterMapper aspect of category_types, with the group partners : the title of each category in the language of the page, followed by its uid. See its documentation.
  • The sorting is two segments, field and direction:

    Sorting English German
    Title title titel
    Last updated last-updated zuletzt-aktualisiert
    Sorting of the page tree sorting sortierung
    Ascending, descending asc, desc aufsteigend, absteigend

    A sorting value of the other language is a 404, not a second address of the same list. The filter segment is read by the uid, so it resolves under the title of any language.

The enhancers declare no defaults. A link with the default sorting keeps it in the path, because the page without any argument is where the content element's preselected categories and sorting apply. A visitor who removed a preselected category must not get it back.

The links the list renders itself use the routes: the redirect after the filter form, the pagination and the tags of Active filters, reset link and result count.

Another language 

The file maps English and German. A site with a further language adds localeMap items to the aspects in its own site configuration. The import appends list items, so the site's own items come after the shipped ones:

config/sites/my_site/config.yaml
routeEnhancers:
  AcademicPartnersList:
    limitToPages: [12]
    aspects:
      page_key:
        localeMap:
          - locale: 'fr.*'
            value: 'page'
      sorting_field:
        localeMap:
          - locale: 'fr.*'
            map:
              titre: 'title'
              mise-a-jour: 'lastUpdated'
              tri: 'sorting'
      sorting_direction:
        localeMap:
          - locale: 'fr.*'
            map:
              croissant: 'asc'
              decroissant: 'desc'
Copied!

The same goes for the map, under AcademicPartnersMap .

A language without localeMap items of its own uses the English keys and values. A value missing from the map of a language keeps its query argument in that language.

The page cache 

The sorting is a static route argument, so each of the six sortings is a page cache entry of its own, per page and language. A path without a sorting is one more entry, and the page without arguments another, eight in all. The filter and the page are dynamic arguments and add no entry: the demand of the lists is excluded from the cache hash, so every filter and every page of a list shares one entry.