tt_news和RealURL:缩短新闻文章的URL [英] tt_news and RealURL: shorten URL of news article

查看:163
本文介绍了tt_news和RealURL:缩短新闻文章的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前新闻文章的网址如下

Currently the URL for a news article looks like

www.domain.com/path/to/page/news/news-detail/article/articlename

www.domain.com/path/to/page/news/news-detail/article/articlename

是否可以缩短此URL?例如.错过了文章或新闻详情吗?

Is there a way to shorten this URL? E.g. missing out article or news-detail?

在RealUrl-Configuration中,有一个数组article,但是我不知道是否可以将其更改为例如news-detail ...

In the RealUrl-Configuration there is the array article but I don't know if I can change this for example to news-detail ...

您有什么主意吗?

我正在使用Typo3 4.5.5,realurl 1.11.2和tt_news 3.0.1.

I'm using Typo3 4.5.5, realurl 1.11.2 and tt_news 3.0.1.

推荐答案

如果要排除表示重写URL的新部分的关键字,请使用fixedPostVars:

If you want to exclude the keywords indicating a new part of the rewritten url, use fixedPostVars:

'fixedPostVars' => array(
    '123' =>array(
        array(
            'GETvar' => 'tx_ttnews[tt_news]',
            'lookUpTable' => array(
                'table' => 'tt_news',
                'id_field' => 'uid',
                'alias_field' => 'title',
                'addWhereClause' => ' AND NOT deleted',
                'useUniqueCache' => 1,
                'useUniqueCache_conf' => array(
                    'strtolower' => 1,
                    'spaceCharacter' => '-',
                ),
            ),
        ),
    ),
),

这将创建一个类似于domain.com/article/your-article-title的网址,假定您具有以下站点结构:

This will create a url like domain.com/article/your-article-title, presuming you have the following site structure:

root
 |- news (pid xy)
 |- article (pid 123)

您还可以在同一页面上使用列表和详细信息视图,这将使URL更加简洁(domain.com/news/your-article-title):

You can also have the list and detail view on the same page which would make even cleaner urls (domain.com/news/your-article-title):

root
 |- news (pid 123, configured for list and detail)

这篇关于tt_news和RealURL:缩短新闻文章的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆