【问题标题】:TYPO3 News routing not working properly. But its working in the URL showing in SitemapTYPO3 新闻路由无法正常工作。但它在站点地图中显示的 URL 中工作
【发布时间】:2021-01-13 09:44:05
【问题描述】:

以下是我的 config.yaml 配置,以使详细信息页面 URL 用户友好。

News:
type: Extbase
limitToPages:
  - 23
extension: News
plugin: Pi1
routes:
  -
    routePath: '{news_title}'
    _controller: 'News::detail'
    _arguments:
      news_title: news
  -
    routePath: '/topic/{category_name}'
    _controller: 'News::list'
    _arguments:
      category_name: overwriteDemand/categories
defaultController: 'News::list'
defaults:
  page: '0'
requirements:
  news_title: '^[a-zA-Z0-9].*$'
  page: \d+
aspects:
  news_title:
    type: PersistedAliasMapper
    tableName: tx_news_domain_model_news
    routeFieldName: path_segment
  category_name:
    type: PersistedAliasMapper
    tableName: sys_category
    routeFieldName: path_segment
NewsList:
type: Plugin
routePath: '/browse/{@widget_0/currentPage}'
namespace: tx_news_pi1
aspects:
  '@widget_0/currentPage':
    type: StaticRangeMapper
    start: '1'
    end: '1000'

我需要一个类似的 URL:https://www.example.com/article/lorem-ipsum-dolor

但是获取到的网址是:https://www.example.com/article/?tx_news_pi1%5Bnews%5D=1&cHash=0bfd8bb6d92152b35569116fa86a2406

在其他项目中也使用相同的代码它在那里完美地工作。 但是在我的 sitemap.xml 中,我可以看到正确的 URL。

谁能帮帮我?为什么 URL 仅在站点地图中是正确的。

谢谢。

【问题讨论】:

    标签: typo3 tx-news typo3-10.x


    【解决方案1】:

    我发现了问题。

    link {
        skipControllerAndAction = 1
    }
    

    我的新闻设置中有一个 skipControllerandAction。我已将其删除,现在它运行良好。

    谢谢!!

    【讨论】:

      【解决方案2】:

      上述解决方案(来自上一个答案)适用于我 - 删除/评论skipControllerAndAction:

      link {
          #skipControllerAndAction = 1
      }
      

      【讨论】:

      • 这似乎是在重申已接受的答案,只是说明评论也有效。
      猜你喜欢
      • 1970-01-01
      • 2012-02-08
      • 1970-01-01
      • 1970-01-01
      • 2012-07-28
      • 1970-01-01
      • 2020-03-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多