-
-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicate content when appending .html
to page URLs
#6509
Comments
I think this is more complex than you think. I think this is also and more related with https://github.com/getkirby/kirby/blob/4.3.0/src/Template/Template.php#L48 |
As workaround for users, you can block all 'routes' => [
[
// blocks all requests to *.html and returns 404
'pattern' => '(:all)\.html',
'action' => function ($all) {
return false;
}
]
] |
I'm thinking this could be solved by
|
TBH I think there should not be a default type at all, at least not for the routes and finding the correct template file. The only thing the type needs to matter for is the response |
@lukasbestle But what's the best way forward? Getting fully rid of a default type sounds like it could be result in much larger breaking changes as the template class is quite fundamental. Wouldn't we solve this issue as well with checking for |
The issue is: If a The So there are two cases IMO:
I can't see a case that leaves room for a default extension and I have no idea why we (probably I) implemented it this way back then. |
@lukasbestle I tried to implement it but this leads into a rabbit whole as in so many places Kirby has the premise that In Kirby's logic, having two templates Which is why I think |
Description
Kirby renders the same page if
.html
is appended to the page URL as if no content representation is appended at all.Expected behavior
.html
should behave like.somethinginvalid
and render a 404 unless a template.html.php
actually exists.To reproduce
Visit https://getkirby.com/docs/guide/quickstart and https://getkirby.com/docs/guide/quickstart.html
Your setup
Kirby Version
4.3.0
Additional context
I believe this is caused by
$page->render(array $data = [], $contentType = 'html')
. Because$contentType
defaults tohtml
if no content representation was called, it cannot differentiate betweenpage.html
andpage
. In both cases it gets$contentType = 'html'
.So to fix this, we would need to change the default to
string|null $contentType = null
. Only ifempty($contentType) === true
, the main template would be loaded.html
would then load a.html.php
template if it exists.This would be a breaking change, so v5 would be a good candidate.
The text was updated successfully, but these errors were encountered: