在 TYPO3 中为 tt_address 生成 SEO 站点地图以及如何使用 slugs 进行美化

generate SEO sitemap for tt_address in TYPO3 and how to beautify with slugs

我整晚都在搜索如何为 tt_address 记录生成站点地图,但找不到任何东西……有人知道如何生成它吗?

我也使用路由增强器,有没有办法通过使用 slugs 而不是那些长控制器、ID 等 URL 来美化我的站点地图?

所以在阅读和调整之后,我想出了一个可行的解决方案:

tx_seo.config.xmlSitemap.sitemaps {
  addresses {
    provider = TYPO3\CMS\Seo\XmlSitemap\RecordsXmlSitemapDataProvider
    config {
      table = tt_address
      sortField = sorting
      lastModifiedField = tstamp
      ### ID of address storage records ###
      pid = 13
      recursive = 2
      url {
        ### ID of detail view page ###
        pageId = 18
        fieldToParameterMap {
          uid = tx_ttaddress_listview[address]
        }
        additionalGetParameters {
          tx_ttaddress_listview.controller = Address
          tx_ttaddress_listview.action = show
        }
        useCacheHash = 1
      }
    }
  }
}

routeenhancer 是:

routeEnhancers:
  AddressPlugin:
    type: Extbase
    extension: TtAddress
    plugin: ListView
    routes:
      -
        routePath: /
        _controller: 'Address::list'
      -
        routePath: '/{address_slug}'
        _controller: 'Address::show'
        _arguments:
          address_slug: address
    aspects:
      address_slug:
        type: PersistedAliasMapper
        tableName: tt_address
        routeFieldName: slug