primer icon indicating copy to clipboard operation
primer copied to clipboard

Use safe access for undefined variables

Open fulldecent opened this issue 3 years ago • 0 comments

Currently there is this code:

<html lang="{{ page.lang | default: site.lang | default: "en-US" }}">

This causes an error when rendering the page in strict mode. In the config use:

# Cause a build to fail if there is a YAML syntax error in a page's front matter.
strict_front_matter: true

# https://jekyllrb.com/docs/configuration/liquid/
liquid:
  error_mode: strict
  strict_variables: true
  strict_filters: true

Please update this to use the safe checkers like: site contains "title".

And of course upstream they should also have default suppress these errors. But whether that is implemented or not, the GitHub Pages default theme should work in strict mode.

fulldecent avatar Feb 09 '23 17:02 fulldecent