---
title: "How To: Route Enhancer For News"
url: "https://news.typo3.com/article/how-to-route-enhancer-for-news"
description: "One of TYPO3’s core features are Human Readable URLs. Even though they work fine for standard pages, some extbase extensions like ext:news require specific adjustments. In this article, Steffen Dietrich, a former trainee of our “Send Your Junior!” program, explains how to configure readable URLs for your news section."
image: "https://news.typo3.com/_assets/d1e01514e4c4a5b3147940fa2ec50682/Images/og-image-news.jpg"
date: 2025-11-03
modified: 2025-11-03
categories:
  - "Developer & Technology"
---

# How To: Route Enhancer For News

- [Developer & Technology](https://news.typo3.com/article/category/developer-technology)

How To: Route Enhancer For News
===============================

28 March 2019

![](https://news.typo3.com/fileadmin/_processed_/d/a/csm_route_enhancer_news_header_image_7dd2fa1081.webp)

One of TYPO3’s core features are Human Readable URLs. Even though they are working fine for standard pages, some extbase extensions like ext:news require specific adjustments. In this article, Steffen Dietrich explains how to configure readable URLs for your news section.

- ![](https://news.typo3.com/fileadmin/_processed_/b/d/csm_steffen_f274e911cd.webp)[Steffen Dietrich](https://news.typo3.com/article/author/steffen-dietrich)

```

Thanks to Steffen from Helios IT for sharing!
```

**Human Readable URLs** are nowadays a TYPO3 core feature and are configured with the new [Site Configuration](https://docs.typo3.org/typo3cms/extensions/core/Changelog/9.2/Feature-84581-SiteHandling.html "Introduce Site Handling"). While it's working nicely for standard page URLs, there are some adjustments needed for extbase extensions like ext:[news](https://extensions.typo3.org/extension/news/ "News"). In this short article we’ll have a look at that specific part of configuration and we’ll show you how to create a nice and readable URL for your news section.

First of all, we assume that you already have a page tree with some pages and a complete news setup with at least a List view on one page, a Detail view on another and some news articles. You also need a Site Configuration, so that the URL on your page is already cleaned up and no longer contains the part *.../index.php?id=1234*. If you need some advice for that have a look at the [documentation](https://docs.typo3.org/typo3cms/extensions/core/Changelog/9.2/Feature-84581-SiteHandling.html "Introduce Site Handling").

With that done, we need to configure the *config.yaml* file to insert our adjustments for ext:news. This activity has not yet an interface, but you can include that directly into the configuration file. Usually the file should be located at docroot/config or inside typo3conf, this depends on your installation.

*/sites/\[YourSitesConfiguration\]/config.yaml*
 and there you search for the line *routes: {  }*. Insert the following lines directly after this. Watch the indents, your code should look like this:

```
```yaml
...
routes: {  }
routeEnhancers:
	NewsPages:
		type: Extbase
		# add every page-ID that contains a News Plugin, but not the News Folder. Important: don't use space between the IDs
		limitToPages: [1,2,3...]
		extension: News
		plugin: Pi1
		routes:
			# Detail view
			# example URL given: "/myDetail?tx_news_pi1[action]=detail&tx_news_pi1[controller]=News&tx_news_pi1[news]=2"
			- { routePath: '/{myNewsTitle}', _controller: 'News::detail', _arguments: {'myNewsTitle': 'news'} }
			# Pagination
			# example URL given: "/myListWithPagination?tx_news_pi1[@widget_0][currentPage]=2"
			- { routePath: '/{myPagination}', _controller: 'News::list', _arguments: {'myPagination': '@widget_0/currentPage'} }
			# DateMenu
			# example URL given: "/myListWithDateMenu?tx_news_pi1[controller]=News&tx_news_pi1[overwriteDemand][month]=12&tx_news_pi1[overwriteDemand][year]=2018"
			# if you want the month first, make it '/{month}/{year}'
			- { routePath: '/{year}/{month}', _controller: 'News::list', _arguments: {'year' : 'overwriteDemand/year', 'month' : 'overwriteDemand/month'} }
		defaultController: 'News::list'
		defaults:
			myPagination: '1'
		requirements:
			myPagination: '\d+'
		aspects:
			# here we get the needed information for a nice URL for _arguments
			myNewsTitle: { type: PersistedAliasMapper, tableName: 'tx_news_domain_model_news', routeFieldName: 'path_segment' }
			myPagination: { type: StaticRangeMapper, start: '1', end: '100' }
			month:
				type: StaticValueMapper
				map:
					# DateMenu => the month for the URL. We assume that German is the default language. The URL will be ".../maerz/2018"
					januar: 1
					februar: 2
					maerz: 3
					april: 4
					mai: 5
					juni: 6
					juli: 7
					august: 8
					september: 9
					oktober: 10
					november: 11
					dezember: 12
				localeMap:
					# If you got more than one language. For the locale go to "Sites Configuration" -> Tab "Languages" -> Locale
					- locale: 'en_EN'
						map:
							# translated month for URL
							january: 1
							february: 2
							march: 3
							april: 4
							may: 5
							june: 6
							july: 7
							august: 8
							september: 9
							october: 10
							november: 11
							december: 12
```
```

First of all: save the file and clear the complete cache (Backend -> Maintenance -> Flush Cache). It’s never a bad idea to clear the whole cache after changing the config.yaml.
 Now, what has been done so far? Time for some explanations:

With the line limitToPages: \[1,2,3...\] we’re determining on which page ID we want to add our Route Enhancing. This is mandatory, otherwise nothing would change at all. After that we take care of the routes. For example:

```
```yaml
- { routePath: '/{myNewsTitle}', _controller: 'News::detail', _arguments: {'myNewsTitle': 'news'} }
```
```

*routePath* is the URL we’re aiming for in the end. Since this is about the Detail-View we need the \_controller set to News::detail. If the routePath has more than one argument you can arrange them in any order you want. For example /{year}/{month} can easily be flipped around if you want the month mentioned first. That would be /{month}/{year}.

Last but not least the *\_arguments*...here we get the necessary configuration from the *aspects* (we cover that in a few moments).

The *\_arguments* are the part from the URL you want to change e.g. the pagination

*.../myListWithPagination?tx\_news\_pi1\[@widget\_0\]\[currentPage\]=2*

With

*\_arguments {'myPagination': '@widget\_0/currentPage'}*

you’re telling TYPO3 to grab the *@widget...* code and put it into *myPagination*.
 After that the aspects come into place and map that information with a simple static range from 1-100. Be advised that it won't work if the URL is not correct. Let's say your URL contains .*..&tx\_news\_pi1\[year\]=2018* and your *\_arguments* is only *{'year' : 'overwriteDemand/year'}*. Since you're looking for overwriteDemand in the URL but don't provide it, the *\_arguments* won't match here and nothing will happen.

Now, as mentioned before, the aspects. The most common practice of an aspect is a so-called mapper and currently we’ve got three of them. (*StaticRangeMapper*, *PersistedAliasMapper*, *PersistedPatternMapper*). Check out [the changelog](https://docs.typo3.org/typo3cms/extensions/core/Changelog/9.5/Feature-86365-RoutingEnhancersAndAspects.html "Routing Enhancers and Aspects") for more information and some examples on how to use them. In short, you just replace the given info with fields from the database or just some numbers from 1-100 like in the StaticRangeMapper.

For example the line

```
```yaml
myNewsTitle: { type: PersistedAliasMapper, tableName: 'tx_news_domain_model_news', routeFieldName: 'path_segment' }
```
```

You can read this like "Go to database-table *tx\_news\_domain\_model\_news*, grab the content from *path\_segment*, map it over the stuff you have in *myNewsTitle* and show that in the URL". Keep in mind that *path\_segment* is a field specific to ext:news. If you got your own extension you need to adapt it.

But what if something is broken? First of all, always check the indents. That usually fixes 90% of the problems. Also make sure that your *limitToPages* has no spaces between the IDs. And, as already mentioned, check the correct URL. It's very easy to miss something in the parameters.

![](https://news.typo3.com/fileadmin/_processed_/b/d/csm_steffen_3d85bb467c.webp)

About the Author

[Steffen Dietrich](https://news.typo3.com/article/author/steffen-dietrich)

TYPO3 Developer,Berlin, Germany

While studying computer science at the TFH Berlin and working for the company Secrypt around 2009, he came in touch with TYPO3. His first job was to keep the content and the TYPO3 installation up-to-date. This is where he started his ongoing relationship with TYPO3. After that he continued using TYPO3 for companies like Frogster, Gameforge or AgenturWebfox, where he kept all websites alive and running and helped other people with their content and daily questions.

Steffen took part in the "Send your Junior!" program and is currently working for Helios where he maintains their websites in TYPO3.

Besides TYPO3, Steffen is always open for a bad one-liner and loves a good comic book.

[More posts by this author](https://news.typo3.com/article/author/steffen-dietrich)