【问题标题】:TYPO3 realurl and tx_news, use title as entire path-segmentTYPO3 realurl 和 tx_news,使用标题作为整个路径段
【发布时间】:2018-04-01 10:52:51
【问题描述】:

我使用 Yoast SEO 插件将 wordpress 网站迁移到 TYPO3,新闻文章的 URL 仅使用域和标题;

## example
http://example.com/news-title/
  • 我使用 TYPO3 v8.7.10、tx_news 6.3.0 和 realurl 2.3.1

    李>
  • 我知道如何使用 docs.typo3.org 中所述的 fixedPostVars 隐藏控制器和操作名称

  • 当然,我可以使用 .htaccess 进行永久重定向

  • 我知道 user_encodeSpURL_postProcuser_decodeSpURL_preProc 的配置技巧,但我至少需要一个目录...

有人知道其他选择吗?

【问题讨论】:

    标签: typo3 realurl tx-news typo3-8.x


    【解决方案1】:

    我提出这个解决方案

    1) 跳过不需要的参数

    通过使用以下设置

    plugin.tx_news {
            settings {
                    link {
                            skipControllerAndAction = 1
                    }
            }
    }
    

    链接不再包含控制器和操作。我更喜欢使用它而不是在 realurl 中删除它,因为 realurl 中的魔法较少。

    2.) 在主页上呈现单个视图

    只是为了澄清:主页是指第一页。

    [globalVar = GP:tx_news_pi1|news > 0] && [globalVar = TSFE:id = HOMEPAGE-ID]
      lib.news = USER
      lib.news {
                    userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
                    pluginName = Pi1
                    vendorName = GeorgRinger
                    extensionName = News
                    controller = News
                    settings =< plugin.tx_news.settings
                    persistence =< plugin.tx_news.persistence
                    view =< plugin.tx_news.view
                    action = detail
                    switchableControllerActions.News.1 = detail
      }
      page.10 < lib.news
    [end]
    

    这只是一个概念证明,因为最终集成取决于如何呈现您的模板和内容。您还可以删除 page.10 &lt; lib.news 并在您的内容中检查变量 lib.news,或者将其分配给变量并在模板中检查。

    【讨论】:

      【解决方案2】:

      与结合

      您可以创建这样的 URL。 但我建议不要使用起始页并创建重定向到例如http://example.com/article/news-title/.

      【讨论】:

      • 智能思维利用首页进行细节展示!这可能是唯一的方法......只是这不是一个真正的选择,因为我将家庭用于许多其他内容......
      • 您可以使用简单的 ts 条件覆盖内容输出
      • @GeorgRinger ...请提供答案!!!如果你有解决方案,我会给你分配学分!!
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多