SEO

Routing configuration

Nice URLs for the single view

Attention

Please enable the seminars "URL segment" (slug) field for your editors. Otherwise, you might get exceptions in the frontend if an event does not have a slug.

First run the upgrade wizards to generate the slugs for all event records. (You can change them later to suit your needs.)

Then add this to your site configuration file:

routeEnhancers:
  EventSingleView:
    type: Plugin
    limitToPages:
      - 17
    routePath: '/{slug}'
    namespace: 'tx_seminars_pi1'
    _arguments:
      slug: showUid
    requirements:
      slug: '[a-z0-9/\-]+'
    aspects:
      slug:
        type: PersistedAliasMapper
        tableName: 'tx_seminars_seminars'
        routeFieldName: 'slug'

If you already have route enhancers configured, add the EventSingleView enhancer next to your other router enhancers.

The limitToPages setting is optional, but required for better performance. The given page UID(s) should be the page(s) on which the seminars single view content element is located.

Nice URLs for the registration form

Add this to your site configuration file:

routeEnhancers:
  EventRegistration:
    type: Extbase
    limitToPages:
      - 18
    extension: Seminars
    plugin: EventRegistration
    defaultController: 'EventRegistration::checkPrerequisites'
    routes:
      - routePath: '/check/{event}'
        _controller: 'EventRegistration::checkPrerequisites'
        _arguments:
          event: event
      - routePath: '/new/{event}'
        _controller: 'EventRegistration::new'
        _arguments:
          event: event
    aspects:
      event:
        type: PersistedAliasMapper
        tableName: 'tx_seminars_seminars'
        routeFieldName: 'uid'
      registration:
        type: PersistedAliasMapper
        tableName: 'tx_seminars_attendances'
        routeFieldName: 'uid'

If you already have route enhancers configured, add the EventRegistration enhancer next to your other router enhancers.

The limitToPages setting is optional, but required for better performance. The given page UID(s) should be the page(s) on which the registration form content element is located.

Automatic page titles for the single view

Add this to your TypoScript setup:

config.pageTitleProviders {
  eventTitle {
    provider = OliverKlee\Seminars\Seo\SingleViewPageTitleProvider
    before = record
  }
}

Exclude the single view page without an event URL from getting indexed

  1. Edit the page properties of your single view page(s).

  2. Navigate to the "SEO" tab.

  3. Disable "Index this page".

  4. Then add this code to your TypoScript setup:

# Re-enable indexing for event single view pages, but not for the (empty)
# detail page without any event UID parameter
[traverse(request.getQueryParams(), 'tx_seminars_pi1/showUid') > 0]
  page.meta {
    robots = index,follow
    robots.replace = 1
  }
[global]

PSR-14 event to change the generated slug for an event

You can use the PSR-14 event OliverKlee\Seminars\Seo\Event\AfterSlugGeneratedEvent to change the slug for an event before it gets written to the database.