简体   繁体   English

tt_news和RealURL:缩短新闻文章的网址

[英]tt_news and RealURL: shorten URL of news article

Currently the URL for a news article looks like 目前,新闻文章的URL看起来像

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

Is there a way to shorten this URL? 有没有办法缩短这个URL? Eg missing out article or 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 ... 在RealUrl-Configuration中有阵列article但我不知道我是否可以将其更改为例如新闻详细信息...

Do you have some ideas? 你有什么想法吗?

I'm using Typo3 4.5.5, realurl 1.11.2 and tt_news 3.0.1. 我正在使用Typo3 4.5.5,realurl 1.11.2和tt_news 3.0.1。

If you want to exclude the keywords indicating a new part of the rewritten url, use fixedPostVars : 如果要排除指示重写URL的新部分的关键字,请使用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' => '-',
                ),
            ),
        ),
    ),
),

This will create a url like domain.com/article/your-article-title , presuming you have the following site structure: 这将创建一个像domain.com/article/your-article-title的网址,假设您有以下网站结构:

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

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 ): 您还可以在同一页面上显示列表和详细信息视图,这样可以创建更清晰的网址( domain.com/news/your-article-title ):

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

One way is to exclude some pages to be shown in the URL path ? 一种方法是排除一些要在URL路径中显示的页面?

www.domain.com/news-detail/article/articlename

You could also use another key as identifier (for example, Id instead of the news title). 您还可以使用另一个键作为标识符(例如,Id而不是新闻标题)。 It will be less human-readable, but much shorten. 它将不那么人性化,但会缩短很多。

www.domain.com/news-detail/article/articleid

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM