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

Unquoted language code "no" not recognized in _config.yml #9571

Open
VikingKing opened this issue Mar 28, 2024 · 1 comment
Open

Unquoted language code "no" not recognized in _config.yml #9571

VikingKing opened this issue Mar 28, 2024 · 1 comment

Comments

@VikingKing
Copy link

VikingKing commented Mar 28, 2024

Operating System

Debian 12

Ruby Version

ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux-gnu]

Jekyll Version

jekyll 4.3.3

GitHub Pages Version

No response

Expected Behavior

'lang: no' in _config.yml should sent the language to Norwegian.
Thus the html header should be

<!DOCTYPE html>
<html lang="no"><head>
  <meta charset="utf-8">

Current Behavior

When setting the lang parameter in _config.yml, Jekyll seems to interpret the unquoted language code "no" (for Norwegian) as the English word "no" rather than a valid language code and uses the default of "en" instead.

<!DOCTYPE html>
<html lang="en"><head>
  <meta charset="utf-8">

This unexpected behavior requires workarounds and suggests a potential bug.

Relevant log output

No response

Code Sample

  1. Create a new Jekyll project or modify an existing one.

  2. In the _config.yml file, set the following:
    lang: no # Unquoted language code does not work as expected

  3. Build or serve the Jekyll site. Observe the resulting language settings shown as:

<!DOCTYPE html>
<html lang="en"><head>
  <meta charset="utf-8">
  1. Change the _config.yml setting to:
    lang: "no" # Quoted language code works correctly

  2. Rebuild or reserve the site. The Norwegian language setting should now be applied.

<!DOCTYPE html>
<html lang="no"><head>
  <meta charset="utf-8">

Workaround is to use quotes around the language code.
However this is not according to the documented syntax and does not seem to be needed with other language codes like french (fr).

Please investigate whether this is a bug in Jekyll's handling of language codes or if this behavior is documented and requires a specific syntax.

@mkasberg
Copy link
Contributor

While perhaps surprising, this is documented behavior of YAML. no is treated as boolean false by YAML. As you've already found, quotes are the correct way to represent the string "no".

So definitely not a bug in Jekyll itself, but were there any specific Jekyll docs that led you astray?

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

2 participants