You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

TYPO3 tx_news归档页OverwriteDemand页面标题设置技术咨询

Setting tx_news OverwriteDemand to Page Title for Archive Pages

Got it, let's get your archive page sorted where you want to use the page title to set tx_news's OverwriteDemand. Here's a step-by-step solution that works with your existing List.html template and integrates the page title properly:

1. Update Your List.html Template

Your current template handles category-based titles, so we'll extend that to include the page title in both the heading/title tag and the OverwriteDemand setting. Here's the adjusted code:

<!-- List Title & OverwriteDemand Setup -->
<f:if condition="{news.0.categories}">
    <f:then>
        <f:for each="{news.0.categories}" as="category">
            <n:titleTag>
                <f:format.htmlentitiesDecode>{f:translate(key:'archive')} - {category.title}</f:format.htmlentitiesDecode>
            </n:titleTag>
            <div class="list-title">
                <h1>{f:translate(key:'archive')} - {category.title}</h1>
            </div>
        </f:for>
    </f:then>
    <f:else>
        <!-- Fallback to page title when no categories are present -->
        <n:titleTag>
            <f:format.htmlentitiesDecode>{f:translate(key:'archive')} - {page.title}</f:format.htmlentitiesDecode>
        </n:titleTag>
        <div class="list-title">
            <h1>{f:translate(key:'archive')} - {page.title}</h1>
        </div>
    </f:else>
</f:if>

<!-- Set OverwriteDemand to use the page title -->
<f:if condition="{page.title}">
    <f:alias map="{overwriteDemand: '{newsDemand}'}">
        <f:setter property="overwriteDemand.searchWords" value="{page.title}" />
    </f:alias>
</f:if>

This does two key things:

  • Maintains your existing category-based title logic, with a clean fallback to the page title when no categories are active.
  • Dynamically sets the searchWords property of the news demand to the current page's title, which fulfills your requirement to use the page title in OverwriteDemand.

2. Alternative: TypoScript Setup

If you'd rather handle this via TypoScript (which can be cleaner for global settings across multiple archive pages), add this to your site's setup TS:

plugin.tx_news.settings.list.overwriteDemand {
    searchWords = TEXT
    searchWords.data = page:title
}

This will automatically inject the page title into the news demand's search parameter for all archive pages using this plugin configuration.

Key Notes:

  • If you're using the Category Menu to filter news, ensure the menu's OverwriteDemand doesn't overwrite the page title setting. The template approach handles this naturally since it applies when the list renders, after any menu filters are applied.
  • The {page.title} variable is available in Fluid templates by default, but if you're working in a partial, make sure you're passing the page object into the partial context if needed.

内容的提问来源于stack exchange,提问作者Jonathan Gaardlykke

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 08:22:57