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

Modular content with missing template file ending up using non-modular template #3218

Closed
mahagr opened this issue Feb 11, 2021 · 5 comments
Closed
Assignees

Comments

@mahagr
Copy link
Member

mahagr commented Feb 11, 2021

If a modular template file is missing, Grav ends up using the default page type, thus replicating the whole HTML multiple times inside the document.

@mahagr mahagr added the bug label Feb 11, 2021
@mahagr mahagr self-assigned this Feb 11, 2021
mahagr added a commit that referenced this issue Feb 11, 2021
@mahagr mahagr added the fixed label Feb 11, 2021
@mahagr mahagr closed this as completed Feb 17, 2021
@pamtbaau
Copy link
Contributor

As a side effect, every non-existing template is being replaced with user/themes/<theme>/default.html.twig instead of /system/templates/default.html.twig which contains a proper error message.

When working on a discourse question about switching themes, it took me a while to figure out why a non-existing template was displayed using default.html.twig instead of using the /system/templates/default.html.twig.

I think issues with non-existing templates should not be hidden and /system/templates/default should be shown instead.

@mahagr
Copy link
Member Author

mahagr commented Sep 29, 2021

It's not possible to do that as twig doesn't tell us where the file comes from. So if it's inside a lookup path, it gets picked up.

@pamtbaau
Copy link
Contributor

IMHO a missing template is an unexpected exception which the developer/admin should be notified about in an early stage. Currently the exception is buried which is confusing and makes the issue hard to detect.

@mahagr
Copy link
Member Author

mahagr commented Sep 30, 2021

I tend to agree, but we cannot do that because many sites rely on showing default template with custom filenames.

What we could do, though, is to make this a configuration option. Maybe you should create a new issue about it?

@pamtbaau
Copy link
Contributor

Maybe you should create a new issue about it?

See #3453

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

2 participants