Streamline routing

Use _uid suffix when uids are used.
Add test to ensure topics are working as expected (regarding routing).
This commit is contained in:
Daniel Siepmann 2021-09-13 08:51:49 +02:00
parent 5358b7f914
commit 394b38beb3
7 changed files with 15 additions and 15 deletions

View file

@ -42,7 +42,7 @@ class SitemapDataProvider extends RecordsXmlSitemapDataProvider
array $config = [], array $config = [],
ContentObjectRenderer $cObj = null ContentObjectRenderer $cObj = null
) { ) {
$categoryUid = intval($request->getQueryParams()['category_id'] ?? 0); $categoryUid = intval($request->getQueryParams()['category_uid'] ?? 0);
if ($categoryUid > 0) { if ($categoryUid > 0) {
$pageUids = $this->getPageUidsWithRelationToCategory($categoryUid); $pageUids = $this->getPageUidsWithRelationToCategory($categoryUid);
$config['additionalWhere'] = ($config['additionalWhere'] ?? '') $config['additionalWhere'] = ($config['additionalWhere'] ?? '')

View file

@ -146,7 +146,7 @@ services:
$rules: $rules:
topics: topics:
matches: > matches: >
request.getQueryParams()["topic_id"] > 0 request.getQueryParams()["topic_uid"] > 0
and not (context.getAspect("backend.user").isLoggedIn()) and not (context.getAspect("backend.user").isLoggedIn())
and not (context.getAspect("frontend.preview").isPreview()) and not (context.getAspect("frontend.preview").isPreview())
and not (request.getHeader("User-Agent")[0] matches "/^TYPO3|TYPO3 linkvalidator/") and not (request.getHeader("User-Agent")[0] matches "/^TYPO3|TYPO3 linkvalidator/")
@ -154,5 +154,5 @@ services:
and not (request.getHeader("User-Agent")[0] matches "/Wget|curl|Go-http-client/") and not (request.getHeader("User-Agent")[0] matches "/Wget|curl|Go-http-client/")
and not (request.getHeader("User-Agent")[0] matches "/bot|spider|Slurp|Sogou|NextCloud-News|Feedly|XING FeedReader|SEOkicks|Seekport Crawler|ia_archiver|TrendsmapResolver|Nuzzel/") and not (request.getHeader("User-Agent")[0] matches "/bot|spider|Slurp|Sogou|NextCloud-News|Feedly|XING FeedReader|SEOkicks|Seekport Crawler|ia_archiver|TrendsmapResolver|Nuzzel/")
and not (request.getHeader("User-Agent")[0] matches "/mattermost|Slackbot|WhatsApp/") and not (request.getHeader("User-Agent")[0] matches "/mattermost|Slackbot|WhatsApp/")
recordUid: 'request.getQueryParams()["topic_id"]' recordUid: 'request.getQueryParams()["topic_uid"]'
tableName: 'sys_category' tableName: 'sys_category'

View file

@ -42,7 +42,7 @@ tt_content.menu_abstract {
special = categories special = categories
special { special {
value { value {
data = GP:topic_id data = GP:topic_uid
intval = 1 intval = 1
} }
sorting = lastUpdated sorting = lastUpdated
@ -62,7 +62,7 @@ tt_content.menu_abstract {
where = uid = ###UID### where = uid = ###UID###
markers { markers {
UID { UID {
data = GP:topic_id data = GP:topic_uid
intval = 1 intval = 1
} }
} }

View file

@ -38,14 +38,14 @@ page {
11 = COA 11 = COA
11 { 11 {
if { if {
isTrue.stdWrap.data = GP:topic_id isTrue.stdWrap.data = GP:topic_uid
} }
1 = TEXT 1 = TEXT
1.char = 10 1.char = 10
2 = TEXT 2 = TEXT
2 { 2 {
noTrimWrap = |<link rel="alternate" title="RSS Feed of blog posts for topic: |" type="application/rss+xml"| noTrimWrap = |<link rel="alternate" title="RSS Feed of blog posts for topic: |" type="application/rss+xml"|
data.dataWrap = DB : sys_category:{GP:topic_id}:title data.dataWrap = DB : sys_category:{GP:topic_uid}:title
} }
3 = TEXT 3 = TEXT
3.char = 32 3.char = 32
@ -59,10 +59,10 @@ page {
10 = TEXT 10 = TEXT
10.value = &type=1533906435&sitemap=blog-posts 10.value = &type=1533906435&sitemap=blog-posts
11 = TEXT 11 = TEXT
11.value = &category_id= 11.value = &category_uid=
12 = TEXT 12 = TEXT
// uid is casted to int within PHP source // uid is casted to int within PHP source
12.data.dataWrap = DB : sys_category:{GP:topic_id}:uid 12.data.dataWrap = DB : sys_category:{GP:topic_uid}:uid
} }
returnLast = url returnLast = url
} }
@ -77,10 +77,10 @@ seo_sitemap {
userFunc { userFunc {
variables { variables {
categoryId = TEXT categoryId = TEXT
categoryId.data = GP:category_id categoryId.data = GP:category_uid
categoryId.intval = 1 categoryId.intval = 1
categoryTitle = TEXT categoryTitle = TEXT
categoryTitle.data.dataWrap = DB : sys_category:{GP:category_id}:title categoryTitle.data.dataWrap = DB : sys_category:{GP:category_uid}:title
} }
} }
} }

View file

@ -51,6 +51,6 @@
</f:section> </f:section>
<f:section name="LinkedTopic"> <f:section name="LinkedTopic">
<a href="{f:uri.page(pageUid: 11, additionalParams: {topic: topicUid})}">{content -> f:spaceless()}</a> <a href="{f:uri.page(pageUid: 11, additionalParams: {topic_uid: topicUid})}">{content -> f:spaceless()}</a>
</f:section> </f:section>
</html> </html>

View file

@ -6,7 +6,7 @@
<f:for each="{topics}" as="topic"> <f:for each="{topics}" as="topic">
<f:if condition="{topic.data.title}"> <f:if condition="{topic.data.title}">
<li> <li>
<a href="{f:uri.page(pageUid: 11, additionalParams: {topic: topic.data.uid})}">{topic.data.title}{f:if(condition: topic.data.count, then: ' ({topic.data.count})')}</a> <a href="{f:uri.page(pageUid: 11, additionalParams: {topic_uid: topic.data.uid})}">{topic.data.title}{f:if(condition: topic.data.count, then: ' ({topic.data.count})')}</a>
</li> </li>
</f:if> </f:if>
</f:for> </f:for>

View file

@ -5,8 +5,8 @@
<f:then> <f:then>
<title>Daniel Siepmann - Coding is Art - Blog Posts {settings.categoryTitle}</title> <title>Daniel Siepmann - Coding is Art - Blog Posts {settings.categoryTitle}</title>
<description>List of {settings.categoryTitle} blog posts at daniel-siepmann.de</description> <description>List of {settings.categoryTitle} blog posts at daniel-siepmann.de</description>
<link>{f:uri.page(pageUid: 11, additionalParams: {topic_id: settings.categoryId}, absolute: 1)}</link> <link>{f:uri.page(pageUid: 11, additionalParams: {topic_uid: settings.categoryId}, absolute: 1)}</link>
<atom:link href="{f:uri.page(pageUid: 1. pageType: 1533906435, additionalParams: {sitemap: 'blog-posts', category_id: settings.categoryId}, absolute: 1)}" rel="self" type="application/rss+xml" /> <atom:link href="{f:uri.page(pageUid: 1. pageType: 1533906435, additionalParams: {sitemap: 'blog-posts', category_uid: settings.categoryId}, absolute: 1)}" rel="self" type="application/rss+xml" />
</f:then> </f:then>
<f:else> <f:else>
<title>Daniel Siepmann - Coding is Art - All Blog Posts</title> <title>Daniel Siepmann - Coding is Art - All Blog Posts</title>