jekyll: [Bug]: "undefined method `yaml_file?' for # in /_layouts/single/html

Operating System

windows 10

Ruby Version

whatever github builds with

Jekyll Version

whatever github builds with

GitHub Pages Version

Latest

Expected Behavior

When I push code I except the build to not fail, it worked last week but something changed this week and it no longer builds

Current Behavior

it fails to build after pushing code to github

Relevant log output

/usr/local/bundle/gems/jekyll-3.9.5/lib/jekyll/excerpt.rb:91: warning: Jekyll::Excerpt#yaml_file? at /usr/local/lib/ruby/2.7.0/forwardable.rb:154 forwarding to private method Jekyll::Page#yaml_file?
  Liquid Exception: undefined method `yaml_file?' for #<Jekyll::Page @name="404.md"> in /_layouts/single.html
/usr/local/lib/ruby/2.7.0/forwardable.rb:233:in `yaml_file?': undefined method `yaml_file?' for #<Jekyll::Page @name="404.md"> (NoMethodError)
	from /usr/local/bundle/gems/jekyll-3.9.5/lib/jekyll/excerpt.rb:91:in `render_with_liquid?'
	from /usr/local/bundle/gems/jekyll-3.9.5/lib/jekyll/renderer.rb:77:in `render_document'
	from /usr/local/bundle/gems/jekyll-3.9.5/lib/jekyll/renderer.rb:62:in `run'
	from /usr/local/bundle/gems/jekyll-3.9.5/lib/jekyll/excerpt.rb:83:in `output'
	from /usr/local/bundle/gems/jekyll-3.9.5/lib/jekyll/excerpt.rb:70:in `to_s'
	from /usr/local/lib/ruby/2.7.0/forwardable.rb:235:in `to_s'
	from /usr/local/bundle/gems/jekyll-3.9.5/lib/jekyll/filters.rb:19:in `markdownify'
	from /usr/local/bundle/gems/liquid-4.0.4/lib/liquid/strainer.rb:56:in `invoke'
	from /usr/local/bundle/gems/liquid-4.0.4/lib/liquid/context.rb:86:in `invoke'
	from /usr/local/bundle/gems/liquid-4.0.4/lib/liquid/variable.rb:84:in `block in render'
	from /usr/local/bundle/gems/liquid-4.0.4/lib/liquid/variable.rb:82:in `each'
	from /usr/local/bundle/gems/liquid-4.0.4/lib/liquid/variable.rb:82:in `inject'
	from /usr/local/bundle/gems/liquid-4.0.4/lib/liquid/variable.rb:82:in `render'
	from /usr/local/bundle/gems/liquid-4.0.4/lib/liquid/block_body.rb:103:in `render_node_to_output'
	from /usr/local/bundle/gems/liquid-4.0.4/lib/liquid/block_body.rb:80:in `render'
	from /usr/local/bundle/gems/liquid-4.0.4/lib/liquid/tags/if.rb:46:in `block (2 levels) in render'
	from /usr/local/bundle/gems/liquid-4.0.4/lib/liquid/tags/if.rb:44:in `each'
	from /usr/local/bundle/gems/liquid-4.0.4/lib/liquid/tags/if.rb:44:in `block in render'
	from /usr/local/bundle/gems/liquid-4.0.4/lib/liquid/context.rb:123:in `stack'
	from /usr/local/bundle/gems/liquid-4.0.4/lib/liquid/tags/if.rb:43:in `render'
	from /usr/local/bundle/gems/liquid-4.0.4/lib/liquid/block_body.rb:103:in `render_node_to_output'
	from /usr/local/bundle/gems/liquid-4.0.4/lib/liquid/block_body.rb:82:in `render'
	from /usr/local/bundle/gems/liquid-4.0.4/lib/liquid/template.rb:206:in `block in render'
	from /usr/local/bundle/gems/liquid-4.0.4/lib/liquid/template.rb:240:in `with_profiling'
	from /usr/local/bundle/gems/liquid-4.0.4/lib/liquid/template.rb:205:in `render'
	from /usr/local/bundle/gems/liquid-4.0.4/lib/liquid/template.rb:218:in `render!'
	from /usr/local/bundle/gems/jekyll-3.9.5/lib/jekyll/liquid_renderer/file.rb:30:in `block (2 levels) in render!'
	from /usr/local/bundle/gems/jekyll-3.9.5/lib/jekyll/liquid_renderer/file.rb:42:in `measure_bytes'
	from /usr/local/bundle/gems/jekyll-3.9.5/lib/jekyll/liquid_renderer/file.rb:29:in `block in render!'
	from /usr/local/bundle/gems/jekyll-3.9.5/lib/jekyll/liquid_renderer/file.rb:49:in `measure_time'
	from /usr/local/bundle/gems/jekyll-3.9.5/lib/jekyll/liquid_renderer/file.rb:28:in `render!'
	from /usr/local/bundle/gems/jekyll-3.9.5/lib/jekyll/renderer.rb:126:in `render_liquid'
	from /usr/local/bundle/gems/jekyll-3.9.5/lib/jekyll/renderer.rb:195:in `render_layout'
	from /usr/local/bundle/gems/jekyll-3.9.5/lib/jekyll/renderer.rb:158:in `place_in_layouts'
	from /usr/local/bundle/gems/jekyll-3.9.5/lib/jekyll/renderer.rb:88:in `render_document'
	from /usr/local/bundle/gems/jekyll-3.9.5/lib/jekyll/renderer.rb:62:in `run'
	from /usr/local/bundle/gems/jekyll-3.9.5/lib/jekyll/site.rb:479:in `render_regenerated'
	from /usr/local/bundle/gems/jekyll-3.9.5/lib/jekyll/site.rb:472:in `block in render_pages'
	from /usr/local/bundle/gems/jekyll-3.9.5/lib/jekyll/site.rb:471:in `each'
	from /usr/local/bundle/gems/jekyll-3.9.5/lib/jekyll/site.rb:471:in `render_pages'
	from /usr/local/bundle/gems/jekyll-3.9.5/lib/jekyll/site.rb:192:in `render'
	from /usr/local/bundle/gems/jekyll-3.9.5/lib/jekyll/site.rb:71:in `process'
	from /usr/local/bundle/gems/jekyll-3.9.5/lib/jekyll/command.rb:28:in `process_site'
	from /usr/local/bundle/gems/jekyll-3.9.5/lib/jekyll/commands/build.rb:65:in `build'
	from /usr/local/bundle/gems/jekyll-3.9.5/lib/jekyll/commands/build.rb:36:in `process'
	from /usr/local/bundle/gems/github-pages-230/bin/github-pages:70:in `block (3 levels) in <top (required)>'
	from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
	from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
	from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
	from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
	from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
	from /usr/local/bundle/gems/github-pages-230/bin/github-pages:6:in `<top (required)>'
	from /usr/local/bundle/bin/github-pages:23:in `load'
	from /usr/local/bundle/bin/github-pages:23:in `<main>'
Error:  Logging at level: debug Configuration file: /github/workspace/./_config.yml GitHub Pages: github-pages v230 GitHub Pages: jekyll v3.9.5 Theme: jekyll-theme-primer Theme source: /usr/local/bundle/gems/jekyll-theme-primer-0.6.0 Requiring: jekyll-github-metadata Requiring: jekyll-seo-tag Requiring: jekyll-paginate Requiring: jekyll-sitemap Requiring: jekyll-gist Requiring: jekyll-feed Requiring: jekyll-redirect-from Requiring: jekyll-coffeescript Requiring: jekyll-commonmark-ghpages Requiring: jekyll-github-metadata Requiring: jekyll-relative-links Requiring: jekyll-optional-front-matter Requiring: jekyll-readme-index Requiring: jekyll-default-layout Requiring: jekyll-titles-from-headings GitHub Metadata: Initializing... Source: /github/workspace/. Destination: /github/workspace/./_site Incremental build: disabled. Enable with --incremental Generating... EntryFilter: excluded /README.md EntryFilter: excluded /CHANGELOG.md EntryFilter: excluded /package.json EntryFilter: excluded /Gemfile EntryFilter: excluded /LICENSE Reading: _posts/2012-08-14-blog-post-1.md Reading: _posts/2014-08-14-blog-post-3.md Reading: _posts/2015-08-14-blog-post-4.md Reading: _posts/2199-01-01-future-post.md Reading: _posts/2013-08-14-blog-post-2.md EntryFilter: excluded /assets/js/vendor EntryFilter: excluded /assets/js/plugins Reading: _teaching/2015-spring-teaching-2.md Reading: _teaching/2014-spring-teaching-1.md Reading: _publications/2009-10-01-paper-title-number-1.md Reading: _publications/2015-10-01-paper-title-number-3.md Reading: _publications/2010-10-01-paper-title-number-2.md Reading: _portfolio/portfolio-1.md Reading: _portfolio/portfolio-2.html Reading: _talks/2014-03-01-talk-3.md Reading: _talks/2014-02-01-talk-2.md Reading: _talks/2013-03-01-tutorial-1.md Reading: _talks/2012-03-01-talk-1.md Generating: JekyllRedirectFrom::Generator finished in 0.02408573 seconds. Generating: JekyllOptionalFrontMatter::Generator finished in 0.000212186 seconds. Generating: JekyllReadmeIndex::Generator finished in 0.000398923 seconds. Generating: Jekyll::Paginate::Pagination finished in 5.701e-06 seconds. Generating: Jekyll::JekyllSitemap finished in 0.000294789 seconds. Jekyll Feed: Generating feed for posts Generating: JekyllFeed::Generator finished in 0.000665759 seconds. Generating: JekyllRelativeLinks::Generator finished in 0.00184193 seconds. Generating: JekyllDefaultLayout::Generator finished in 0.000307823 seconds. Requiring: kramdown-parser-gfm Generating: JekyllTitlesFromHeadings::Generator finished in 0.007834659 seconds. Rendering: _posts/2012-08-14-blog-post-1.md Pre-Render Hooks: _posts/2012-08-14-blog-post-1.md Rendering Markup: _posts/2012-08-14-blog-post-1.md Rendering Layout: _posts/2012-08-14-blog-post-1.md Layout source: site Rendering: _posts/2012-08-14-blog-post-1.md/#excerpt Pre-Render Hooks: _posts/2012-08-14-blog-post-1.md/#excerpt Rendering Markup: _posts/2012-08-14-blog-post-1.md/#excerpt Rendering: _posts/2199-01-01-future-post.md/#excerpt Pre-Render Hooks: _posts/2199-01-01-future-post.md/#excerpt Rendering Markup: _posts/2199-01-01-future-post.md/#excerpt Rendering: _posts/2015-08-14-blog-post-4.md/#excerpt Pre-Render Hooks: _posts/2015-08-14-blog-post-4.md/#excerpt Rendering Markup: _posts/2015-08-14-blog-post-4.md/#excerpt Rendering: _posts/2014-08-14-blog-post-3.md/#excerpt Pre-Render Hooks: _posts/2014-08-14-blog-post-3.md/#excerpt Rendering Markup: _posts/2014-08-14-blog-post-3.md/#excerpt Rendering: _posts/2013-08-14-blog-post-2.md/#excerpt Pre-Render Hooks: _posts/2013-08-14-blog-post-2.md/#excerpt Rendering Markup: _posts/2013-08-14-blog-post-2.md/#excerpt GitHub Metadata: Generating for TKKetron/TKKetron.github.io GitHub Metadata: Calling @client.pages("TKKetron/TKKetron.github.io", {}) Rendering: _posts/2013-08-14-blog-post-2.md Pre-Render Hooks: _posts/2013-08-14-blog-post-2.md Rendering Markup: _posts/2013-08-14-blog-post-2.md Rendering Layout: _posts/2013-08-14-blog-post-2.md Layout source: site Rendering: _posts/2014-08-14-blog-post-3.md Pre-Render Hooks: _posts/2014-08-14-blog-post-3.md Rendering Markup: _

Code Sample

I forked the repo: https://github.com/academicpages/academicpages.github.io I had uploaded it to my own GitHub page and it worked fine, however this week I tried to make some changes and nearly went insane thinking I broke something, but after deleting my fork and reforking it still did not build. seeing as that original repo hasn’t been changed in 5 years I do not think it was that.

The error seems to be something with the 404.md file or related to it, but I saw no use of that file anywhere that had been changed. specifically, the error above says in the single file in _layouts, but I see no mention of 404 in that file

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 16 (1 by maintainers)

Commits related to this issue

Most upvoted comments

I’ve sorted it out using a custom GitHub Actions workflow.

Under Settings > Pages > Build and deployment select Github Actions instead of the default Deploy From a Branch then choose (or create) a jekyll configuration. A config YAML file will be generated and placed under .github/workflows/

Here is what the file that i’ve used looks like :

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# Sample workflow for building and deploying a Jekyll site to GitHub Pages
name: Deploy Jekyll site to Pages

on:
  # Runs on pushes targeting the default branch
  push:
    branches: ["main"]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
  contents: read
  pages: write
  id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
  group: "pages"
  cancel-in-progress: false

jobs:
  # Build job
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Setup Ruby
        uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 # v1.161.0
        with:
          ruby-version: '3.1' # Not needed with a .ruby-version file
          bundler-cache: true # runs 'bundle install' and caches installed gems automatically
          cache-version: 0 # Increment this number if you need to re-download cached gems
      - name: Setup Pages
        id: pages
        uses: actions/configure-pages@v4
      - name: Build with Jekyll
        # Outputs to the './_site' directory by default
        run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
        env:
          JEKYLL_ENV: production
      - name: Upload artifact
        # Automatically uploads an artifact from the './_site' directory by default
        uses: actions/upload-pages-artifact@v3

  # Deployment job
  deploy:
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    needs: build
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4

Hope this helps!

Hi, academic-pages are all affected by this bug, any latest news to fix the bug soon?

Without changing anything and pushing a build just now everything is back to working fine. Thank you to those who made the fix on this.