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

Missing template is unexpected exception and should NOT be silenced by using theme's default template #3453

Open
pamtbaau opened this issue Sep 30, 2021 · 2 comments
Milestone

Comments

@pamtbaau
Copy link
Contributor

A page referencing a non-existing template is, IMHO, an unexpected runtime exception. The developer should be notified about this exception.

This issue of non-existing templates could easily be caused by novice users evaluating different themes.

Since commit Added default templates in Grav itself #9880ce (18 Sep 2020), the exception has been silenced by using the theme's default or modular/default templates instead.

I think this is a less then optimal handling of exceptions.

I also don't see a use-case in which silencing the exception is deliberately depended upon.

Alternatives for silencing I could think of:

  • Throw the error again. Which might break sites that deliberately depend on silencing the exception.
  • Log the error and continue as is.
  • When installing new theme, or switching between themes, check if pages reference non-existing templates.
  • Add new check in Problem plugin checking for non-existing templates.
    • User could be asked if check should be run with option to never be asked again
  • During upgrade check for missing templates.
    • User could be asked if check should be run with option to never be asked again.
@hughbris
Copy link
Contributor

This explains some pages unexpectedly rendering without templates I've been seeing recently.

I can see pros and cons for this and probably depends on developer's philosophy. Could we make the behaviour a system toggle? Or standardise a YAML property like fallback_template into themes going forward?

@mahagr
Copy link
Member

mahagr commented Oct 22, 2021

I think this would be a perfect change for Grav 2.0 with maybe the proposed option for 1.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants