Skip to content
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

Twig Runtime Error (IE 11 and Edge 42) #2337

Closed
lazzich opened this issue Jan 15, 2019 · 19 comments
Closed

Twig Runtime Error (IE 11 and Edge 42) #2337

lazzich opened this issue Jan 15, 2019 · 19 comments
Assignees

Comments

@lazzich
Copy link

lazzich commented Jan 15, 2019

Error Message: An exception has been thrown during the rendering of a template ("Template "modular/3-columns.txt.twig" is not defined."). The html.twig template with the same name is definitely there.

You can test this here:
https://www.aepfelundkonsorten.org/home

Site working in Chrome, FF and Edge 42. Not in Edge 41.16, IE 11.

@Perlkonig
Copy link
Contributor

But you're requesting a txt file, not an html file. You need a txt.twig file or you need to fix your request so it's actually requesting text/html from Grav.

@lazzich
Copy link
Author

lazzich commented Jan 15, 2019

Many thanks. Do you know where to do this setting in Grav?

@rhukster
Copy link
Member

This is a browser or server issue.. If the browser is requesting a text file, then it's not serving the page correctly, or the browser is requesting a text resource when it should be requesting an html one.

@garytube
Copy link

garytube commented Feb 8, 2019

I have the same Issue.
Start happening after upgrading to 1.6.0-rc2

@garytube
Copy link

garytube commented Feb 8, 2019

So the issue seams to be related to modular pages. All my other Pages are working just fine.
image

My landingpage.md
`---
title: Landingpage
slug: /

content:
items: '@self.modular'
order:
custom:
- _hero
- _featured
- _getstarted
- _products
- _news
---`

my templates:
image

I'm pretty sure my site worked before in IE11.
Since I have everything in git, i checkout at the pre-rc releases and the bug was also present. So forget about my comment above.

image

php -S localhost:8000 system/router.php works just fine
maybe it's a htaccess problems? Any Ideas @rhukster ?

@rhukster
Copy link
Member

rhukster commented Feb 8, 2019

Ok, i was able to replicate this on my windows machine! I will investigate it!

@rhukster
Copy link
Member

rhukster commented Feb 8, 2019

Ok, it did it one time, but after a refresh, it works every time. Grr.. very tricky to track this down if i can't reliably replicate it.

@garytube
Copy link

garytube commented Feb 8, 2019

Same here, we tested on a bunch machines now. Still got the error
What IE11 Version are you using @rhukster

you can check my test site
http://gidrm.tbodev.de/en (this is the landingpage with 3 modular elements)

@rhukster
Copy link
Member

rhukster commented Feb 8, 2019

Found it! ok, not sure how this happens, but the order of the page types must be wrong. I had txt first, and it should be html. If you edit your user/config/system.yaml file... look for system.pages.types and change that array to:

  types:
    - html
    - htm
    - xml
    - txt
    - json
    - rss
    - atom

This fixed it for me.

@garytube
Copy link

garytube commented Feb 8, 2019

maybe thats why Utils::getExtensionByMime($mimetype); always returned text/plain

and because I have different configs for stage/test/prod the extension order was different on each server and i couldn't figure out why it was working on stage.

@garytube
Copy link

garytube commented Feb 8, 2019

Fixed! Thank you so much!

@lazzich
Copy link
Author

lazzich commented Feb 8, 2019

Did also fix it for me! Thanks guys for looking into it again.

@mahagr
Copy link
Member

mahagr commented Mar 25, 2019

@rhukster Didn't you fix this already?

@rhukster
Copy link
Member

seems not, i need to update the defaults in system.yaml

@rhukster
Copy link
Member

rhukster commented Mar 26, 2019

Now done in 1.6 branch..

@hubionmac
Copy link

The re-ordering of the page types helped me also on Google index, since I got 5xx error every time I tried to reindex the page

@rhukster
Copy link
Member

This fix is now in 1.6 release.

@vanilla-thunder
Copy link

sorry for reopening, but there might be a new side effect (mainly for custom themes):
when missing favicon image file, grav points favicon tag to web root
<link rel="icon" type="image/png" href="/" />
which makes browser request start page with Accept: image/webp,image/apng,image/* header.
And this request makes modular pages being rendered with .txt.twig insterad of .html.twig templates.
This happens in all browsers and changing the order of page types does not help.

Since faulty href and src tags, causing browser to load website once again, are pretty common problem, probably grav should stick to first/default page type here instead of forcing txt?
It was kind of misleading In my case, since grav tried to render txt.twig template instead of just loading exactly the same page once again.

@mahagr
Copy link
Member

mahagr commented May 23, 2019

@vanilla-thunder Could you please create a new issue on this? Also, could you provide a minimal example of what to install to reproduce this issue, it would save some time if some themes work and some not.

@mahagr mahagr added fixed and removed fixed in 1.6 labels Jan 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants