jekyll/jekyll

[Bug]: `page` variables to not rendered correctly

yonz2 opened this issue · 2 comments

Operating System

Ubuntu 20.04.6

Ruby Version

ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]

Jekyll Version

jekyll 4.3.3

  * jekyll (4.3.3)
        Summary: A simple, blog aware, static site generator.
        Homepage: https://jekyllrb.com
        Source Code: https://github.com/jekyll/jekyll
        Changelog: https://github.com/jekyll/jekyll/releases
        Bug Tracker: https://github.com/jekyll/jekyll/issues
        Path: /usr/local/rvm/gems/ruby-3.2.2/gems/jekyll-4.3.3
        Reverse Dependencies: 
                jekyll-data (1.1.1) depends on jekyll (>= 3.3, < 5.0.0)
                jekyll-feed (0.17.0) depends on jekyll (>= 3.7, < 5.0)
                jekyll-include-cache (0.2.1) depends on jekyll (>= 3.7, < 5.0)
                jekyll-polyglot (1.7.0) depends on jekyll (>= 4.0, >= 3.0)
                jekyll-remote-theme (0.4.3) depends on jekyll (>= 3.5, < 5.0)
                jekyll-sitemap (1.4.0) depends on jekyll (>= 3.7, < 5.0)
                minimal-mistakes-jekyll (4.24.0) depends on jekyll (>= 3.7, < 5.0)

GitHub Pages Version

No response

Expected Behavior

I expect the page.title and pages.lang variables to render correctly on bundle exec jekyll build

Current Behavior

Consider this frontmatter for a page:

---
layout: single
title: Über uns
permalink: /about/
page-id: about
header:
  overlay_image: /assets/images/NetInnovate_TitleImage.png
lang: de
toc: false
---

The following code snippet:

  <select id="language-switcher-select" autocompletion="off" onchange="window.location.href = this.value;">
    {% for lang in site.languages %}
      <option value="{{ lang }}" {% if lang==page.lang %}selected{% endif %}>{{ site.data[lang].l10n.lang_name }}</option>
      <!--  {{ lang }} , {{ page.lang }}, {{ site.default_lang }}, {{ page.title }} -->
    {% endfor %}
  </select>

Renders as:

  <select id="language-switcher-select" autocompletion="off" onchange="window.location.href = this.value;">
    
      <option value="en" selected>English</option>
      <!--  en , en, en, Revolutionizing ITSM with AI: Automating Issue Classification and Resolution -->
    
      <option value="de" >Deutsch</option>
      <!--  de , en, en, Revolutionizing ITSM with AI: Automating Issue Classification and Resolution -->
    
  </select>

Here the page.lang and page.title variables are wrong. Their values are actually taken from the frontmatter of the first file in the ./_posts folder. The frontmatter of that file is:

---
layout: posts
title: "Revolutionizing ITSM with AI: Automating Issue Classification and Resolution"
date: 2023-11-15
categories: AI
lang: en
---

Relevant log output

@yonz2 ➜ /workspaces/netinnovate (main) $ bundle exec jekyll build
Configuration file: /workspaces/netinnovate/_config.yml
To use retry middleware with Faraday v2.0+, install `faraday-retry` gem
            Source: /workspaces/netinnovate
       Destination: /workspaces/netinnovate/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
       Jekyll Feed: Generating feed for posts
       Jekyll Feed: Generating feed for posts
                    done in 0.805 seconds.
 Auto-regeneration: disabled. Use --watch to enable.
@yonz2 ➜ /workspaces/netinnovate (main) $ bundle exec jekyll build -V | grep about
To use retry middleware with Faraday v2.0+, install `faraday-retry` gem
           Reading: _pages/about-de.md
           Reading: _pages/about-en.md
           Reading: _pages/about-de.md
           Reading: _pages/about-en.md
         Rendering: _pages/about-en.md
  Pre-Render Hooks: _pages/about-en.md
  Rendering Markup: _pages/about-en.md
Post-Convert Hooks: _pages/about-en.md
  Rendering Layout: _pages/about-en.md
         Rendering: _pages/about-de.md
  Pre-Render Hooks: _pages/about-de.md
  Rendering Markup: _pages/about-de.md
Post-Convert Hooks: _pages/about-de.md
  Rendering Layout: _pages/about-de.md
           Writing: /workspaces/netinnovate/_site/about/index.html
           Writing: /workspaces/netinnovate/_site/de/about/index.html

Code Sample

Steps to reproduce

I use github CodeSpace to run my code.

Repo: https://github.com/yonz2/netinnovate

So to reproduce, create a codespace for the repo, run bundle update followed by bundle exec jekyll build and inspect the generated output in e.g. ./_site/de/about/index.html

See also an issue files on the Polyglot repo untra/polyglot#187

Just curious, was this working properly before 4.3.3 released a few weeks ago? I'm experiencing some other bugs -- possibly related, possibly not -- where code that was working fine previously now throws Liquid errors, and I'm wondering if the last release broke some things.

Not sure ... I gave up on this and re implemented everything in Hugo