jekyll: [Bug]: Error: undefined method `excerpt_separator' for #

Operating System

Ubuntu 22.04.3

Ruby Version

ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21]

Jekyll Version

jekyll 3.9.4

GitHub Pages Version

github-pages 229

Expected Behavior

I expected my site to be built successfully when I run the following:

bundle exec jekyll build --safe

Current Behavior

I get an error when I have an excerpt in a page: https://github.com/remarkablemark/remarkablemark.github.io/pull/71

jekyll 3.9.4 | Error:  undefined method `excerpt_separator' for #<Jekyll::Page>

Relevant log output

Run bundle exec jekyll build --safe
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
Configuration file: /home/runner/work/remarkablemark.github.io/remarkablemark.github.io/_config.yml
To use retry middleware with Faraday v2.0+, install `faraday-retry` gem
            Source: /home/runner/work/remarkablemark.github.io/remarkablemark.github.io
       Destination: /home/runner/work/remarkablemark.github.io/remarkablemark.github.io/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
       Jekyll Feed: Generating feed for posts
jekyll 3.9.4 | Error:  undefined method `excerpt_separator' for #<Jekyll::Page @name="404.md">

      head, _, tail = doc_content.to_s.partition(doc.excerpt_separator)
                                                    ^^^^^^^^^^^^^^^^^^
/home/runner/work/remarkablemark.github.io/remarkablemark.github.io/vendor/bundle/ruby/3.1.0/gems/jekyll-3.9.4/lib/jekyll/excerpt.rb:135:in `extract_excerpt': undefined method `excerpt_separator' for #<Jekyll::Page @name="404.md"> (NoMethodError)

      head, _, tail = doc_content.to_s.partition(doc.excerpt_separator)
                                                    ^^^^^^^^^^^^^^^^^^
	from /home/runner/work/remarkablemark.github.io/remarkablemark.github.io/vendor/bundle/ruby/3.1.0/gems/jekyll-3.9.4/lib/jekyll/excerpt.rb:25:in `initialize'
	from /home/runner/work/remarkablemark.github.io/remarkablemark.github.io/vendor/bundle/ruby/3.1.0/gems/jekyll-relative-links-0.7.0/lib/jekyll-relative-links/generator.rb:173:in `new'
	from /home/runner/work/remarkablemark.github.io/remarkablemark.github.io/vendor/bundle/ruby/3.1.0/gems/jekyll-relative-links-0.7.0/lib/jekyll-relative-links/generator.rb:173:in `replace_relative_links_excerpt!'
	from /home/runner/work/remarkablemark.github.io/remarkablemark.github.io/vendor/bundle/ruby/3.1.0/gems/jekyll-relative-links-0.7.0/lib/jekyll-relative-links/generator.rb:[6](https://github.com/remarkablemark/remarkablemark.github.io/actions/runs/7820440961/job/21335167976?pr=71#step:4:7)4:in `replace_relative_links!'
	from /home/runner/work/remarkablemark.github.io/remarkablemark.github.io/vendor/bundle/ruby/3.1.0/gems/jekyll-relative-links-0.[7](https://github.com/remarkablemark/remarkablemark.github.io/actions/runs/7820440961/job/21335167976?pr=71#step:4:8).0/lib/jekyll-relative-links/generator.rb:44:in `block in generate'
	from /home/runner/work/remarkablemark.github.io/remarkablemark.github.io/vendor/bundle/ruby/3.1.0/gems/jekyll-relative-links-0.7.0/lib/jekyll-relative-links/generator.rb:39:in `each'
	from /home/runner/work/remarkablemark.github.io/remarkablemark.github.io/vendor/bundle/ruby/3.1.0/gems/jekyll-relative-links-0.7.0/lib/jekyll-relative-links/generator.rb:39:in `generate'
	from /home/runner/work/remarkablemark.github.io/remarkablemark.github.io/vendor/bundle/ruby/3.1.0/gems/jekyll-3.9.4/lib/jekyll/site.rb:175:in `block in generate'
	from /home/runner/work/remarkablemark.github.io/remarkablemark.github.io/vendor/bundle/ruby/3.1.0/gems/jekyll-3.9.4/lib/jekyll/site.rb:173:in `each'
	from /home/runner/work/remarkablemark.github.io/remarkablemark.github.io/vendor/bundle/ruby/3.1.0/gems/jekyll-3.9.4/lib/jekyll/site.rb:173:in `generate'
	from /home/runner/work/remarkablemark.github.io/remarkablemark.github.io/vendor/bundle/ruby/3.1.0/gems/jekyll-3.9.4/lib/jekyll/site.rb:70:in `process'
	from /home/runner/work/remarkablemark.github.io/remarkablemark.github.io/vendor/bundle/ruby/3.1.0/gems/jekyll-3.9.4/lib/jekyll/command.rb:2[8](https://github.com/remarkablemark/remarkablemark.github.io/actions/runs/7820440961/job/21335167976?pr=71#step:4:9):in `process_site'
	from /home/runner/work/remarkablemark.github.io/remarkablemark.github.io/vendor/bundle/ruby/3.1.0/gems/jekyll-3.[9](https://github.com/remarkablemark/remarkablemark.github.io/actions/runs/7820440961/job/21335167976?pr=71#step:4:10).4/lib/jekyll/commands/build.rb:65:in `build'
	from /home/runner/work/remarkablemark.github.io/remarkablemark.github.io/vendor/bundle/ruby/3.1.0/gems/jekyll-3.9.4/lib/jekyll/commands/build.rb:36:in `process'
	from /home/runner/work/remarkablemark.github.io/remarkablemark.github.io/vendor/bundle/ruby/3.1.0/gems/jekyll-3.9.4/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
	from /home/runner/work/remarkablemark.github.io/remarkablemark.github.io/vendor/bundle/ruby/3.1.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
	from /home/runner/work/remarkablemark.github.io/remarkablemark.github.io/vendor/bundle/ruby/3.1.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
	from /home/runner/work/remarkablemark.github.io/remarkablemark.github.io/vendor/bundle/ruby/3.1.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
	from /home/runner/work/remarkablemark.github.io/remarkablemark.github.io/vendor/bundle/ruby/3.1.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
	from /home/runner/work/remarkablemark.github.io/remarkablemark.github.io/vendor/bundle/ruby/3.1.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
	from /home/runner/work/remarkablemark.github.io/remarkablemark.github.io/vendor/bundle/ruby/3.1.0/gems/jekyll-3.9.4/exe/jekyll:15:in `<top (required)>'
	from /home/runner/work/remarkablemark.github.io/remarkablemark.github.io/vendor/bundle/ruby/3.1.0/bin/jekyll:25:in `load'
	from /home/runner/work/remarkablemark.github.io/remarkablemark.github.io/vendor/bundle/ruby/3.1.0/bin/jekyll:25:in `<top (required)>'
	from /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `load'
	from /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `kernel_load'
	from /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:28:in `run'
	from /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.1.4/lib/bundler/cli.rb:476:in `exec'
	from /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:[12](https://github.com/remarkablemark/remarkablemark.github.io/actions/runs/7820440961/job/21335167976?pr=71#step:4:13)7:in `invoke_command'
	from /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor.rb:399:in `dispatch'
	from /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.1.4/lib/bundler/cli.rb:30:in `dispatch'
	from /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/base.rb:476:in `start'
	from /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.1.4/lib/bundler/cli.rb:24:in `start'
	from /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.1.4/exe/bundle:46:in `block in <top (required)>'
	from /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.1.4/lib/bundler/friendly_errors.rb:1[23](https://github.com/remarkablemark/remarkablemark.github.io/actions/runs/7820440961/job/21335167976?pr=71#step:4:24):in `with_friendly_errors'
	from /opt/hostedtoolcache/Ruby/3.1.2/x64/lib/ruby/gems/3.1.0/gems/bundler-2.1.4/exe/bundle:34:in `<top (required)>'
	from /opt/hostedtoolcache/Ruby/3.1.2/x64/bin/bundle:[25](https://github.com/remarkablemark/remarkablemark.github.io/actions/runs/7820440961/job/21335167976?pr=71#step:4:26):in `load'
	from /opt/hostedtoolcache/Ruby/3.1.2/x64/bin/bundle:25:in `<main>'
Error: Process completed with exit code 1.

Code Sample

Steps to reproduce issue

Clone repository:

git clone https://github.com/remarkablemark/remarkablemark.github.io.git
cd remarkablemark.github.io

Checkout branch:

git checkout jekyll-error-undefined-method-excerpt_separator

Build site:

bundle exec jekyll build --safe

See https://github.com/remarkablemark/remarkablemark.github.io/pull/71

About this issue

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

Commits related to this issue

Most upvoted comments

For those having this issue specifically with the academicpages template (evidenced potentially by specifically the 404.md file error), it turns out if you remove the excerpt line from 404.md, about.md, and non-menu-page.md, everything deploys properly.

https://github.com/academicpages/academicpages.github.io/issues/1878

Also running into this on gh pages, where you cannot specify the Jekyll version

Second time a charm?

We sent pages-gem v231 everywhere. It reverted (for now) jekyll-relative-links to the previous release. Hopefully that clears up all the issues.

Let us know!

@parkr @yoannchaudet I hate to be a pain, but 3.9.5 is broken for me with a new error:

/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="dpa.md"> in /_layouts/empty.html

That error is from the Github pages build, and I see the same error locally with 3.9.5 on multiple sites. I don’t think that’s an issue with my setup, but for completeness, here is what those files look like for me:

/_layouts/empty.html is my basic layout, it has no front-matter

<!DOCTYPE html>
<html lang="en" class="no-js">
  {% include head.html %}
  <body class="{{ layout.body_class }} {{ page.body_class }} preload">
    <script>document.documentElement.classList.remove("no-js");</script>
    {{ content }}
    {% include scripts.html %}
    <script>document.body.classList.remove("preload");</script>
  </body>
</html>

dpa.md is a regular page in my site. Here is the start of the file

---
layout: policy
title: Data Processing Agreement
excerpt: "Standard agreement for the processing of Customer Data"
permalink: /dpa/
download: "/assets/documents/requestmetrics-dpa-v3.0.pdf"
sitemap:
  priority: 0.5
redirect_from:
  - /gdpr/
---

# Data Processing Agreement
Revision 3.0

If you build your site with Actions (which is the majority of cases), your build should be fixed now. The change made it in https://github.com/actions/jekyll-build-pages/releases/tag/v1.0.11.

Still deploying the changes to Pages’ legacy infrastructure now.

Thanks @parkr for patching Jekyll for us ❤ and sorry for all the troubles.

The root cause appears to be https://github.com/benbalter/jekyll-relative-links/pull/65. It’s using Jekyll::Excerpt with a Jekyll::Page which is not compatible. (It must be used with a Jekyll::Document.)

I am proposing a fix for Jekyll 3.9 in #9550. This will allow Excerpts to be created for Page objects, which I think is best.

after hours of debugging I was able to fix it - https://github.com/ayrat555/ayrat555.github.io/commit/eae9cdc2ae20b5755b68995f5ec1dd8ac54e941a

I added a custom workflow suggested in https://github.com/jekyll/jekyll/issues/9544#issuecomment-1936982361

had to modify gem and config files

also, had to modify the source of the github pages in config

image

Yes, sure, but I’m just talking about the built in gh pages functionality. I don’t want to have to reconfigure the whole site because there appears to be an issue in one version of Jekyll.

Pinning the github-pages version does not appear to work, the builder uses the versions it wants regardless with the message:

Warning: The github-pages gem can’t satisfy your Gemfile’s dependencies.

I think the gem is meant for easily replicating the builder environment on your local machine rather than telling the builder what to use.

I encountered the same issue. It seems an excerpt separator is now required for every excerpt, so I just defined one in my _config.yml file and added it at the end of every excerpt. The build is now OK with jekyll 3.9.4

I’ve spent more than a day on this. I tried all of the above to no avail (and encountered all sorts of other problems due to fiddling with things).

This sounds like a great solution, but can you provide the lines you added to the .yaml file please?

@AndrewWPhillips 2 lines in _config.yml:

posts:
    excerpt_separator: <!--excerptEnd-->

I also had to override some layouts and includes in the Minimal Mistakes theme I am using so that the rendering is OK for the splash layout (it uses the excerpt keyword, which I had to replace: commit here).

I think I found an easy way of using the previous release of pages-build-deployment workflow.

  1. Go to your repository
  2. Click Action menu
  3. Press New workflow button
  4. Search Jekyll
  5. Find the workflow named GitHub Pages Jekyll (not Jekyll) and click Configure button
  6. Change line number 34 to use the previous release of actions/jekyll-build-pages as like:

from:

        uses: actions/jekyll-build-pages@v1

to:

        uses: actions/jekyll-build-pages@v1.0.9
  1. Press Commit changes
  2. (maybe you need to configure Pages build and deployment source)

GitHub Pages Jekyll and pages-build-deployment are essentially same. The main difference of them is an additional report-build-status stage in pages-build-deployment.

You can find more information about 'GitHub Pages Jekyll` workflow at https://github.com/actions/jekyll-build-pages/pkgs/container/jekyll-build-pages

Also, even if you’re still using the github-pages gem, you can specify the Jekyll version by specifying the github-pages gem version. For example, if you set the gem to version 228, it will use Jekyll 3.9.3: https://rubygems.org/gems/github-pages/versions/228

You can pin the version like this in your Gemfile:

gem "github-pages", "=228"

I had the same issue. But I got it to work by rolling back to Jekyll 3.9.3.

(aside) I totally get “you should just use a GH Pages Action like so…” But the popularity - and simplicity! - of GH Pages “just working out of the box” is huge, and it was disappointing (on GH’s part, really, not your’s!) that this now suddenly is breaking deploys to GHPages sites people thought were zero maintenance.

In any case, thanks Jekyll peeps for building and maintaining such an awesome system! 🥰

I’ve spent a few hours debugging this as I have several sites hosted on Github pages that are all unable to deploy. Here’s what I have found based on diving into a lot of the other comments.

GitHub Pages builds are failing with an error like this:

Error: undefined method `excerpt_separator' for #<Jekyll::Page @name="QuickStart.md">`

The file referenced is any Markdown file with a excerpt specified, which we do on lots and lots of files. This error starts in Jekyll 3.9.4, and I see it locally as well. Jekyll 3.9.3 works file. Seems like a bug that should be rolled back by Jekyll.

On Friday, Feb 9th, Github released a change to it’s GitHub Pages default action that updates the github-pages gem to version 229. The main thing that 229 does is upgrade Jekyll to 3.9.4. Boom, broken.

Unfortunately, it doesn’t seem like it’s easy to override this. Specifying gem "github-pages", "=228" in your own gemfile gets you this message:

Warning: The github-pages gem can't satisfy your Gemfile's dependencies. If you want to use a different Jekyll version or need additional dependencies, consider building Jekyll site with GitHub Actions: https://jekyllrb.com/docs/continuous-integration/github-actions/

I opened a bug with Github Actions as this seems like something we should be able to control and override.

The workaround that @QuantKang left works for me, but I don’t like switching all my repos to custom actions just to point at an old version. I feel like this is going to be fixed in the next few days, so I’m not running to update all my pages repositories just yet.

Hopefully this helps the next person that comes looking for why their GitHub Pages are busted right now.

A simple way to work around this issue is defining a new workflow by copying Jekyll workflow:

  1. Go to your repository
  2. Click Action menu
  3. Press New workflow button
  4. Search Jekyll
  5. Find the workflow named Jekyll and click Configure button
  6. Press Commit changes

You may need to pull and push from your local repository to sync with the commit.

The workflow seems designed for the latest stable Jekyll. It uses Jekyll 4.3.3.

If you were using GitHub Pages as the build and deployment source, you should do the following. If not, your changes will be accepted successfully, but you will run into errors because the site would still technically be configured to use GitHub pages.

  • Change the repository from GitHub Pages to GitHub Actions o Go to your repository o Click Settings o Click Pages o Under Build and development…Source, change from Deploy from a Branch to GitHub Actions

I hope this helps someone 😃

I encountered the same issue. It seems an excerpt separator is now required for every excerpt, so I just defined one in my _config.yml file and added it at the end of every excerpt. The build is now OK with jekyll 3.9.4

A simple way to work around this issue is defining a new workflow by copying Jekyll workflow:

  1. Go to your repository
  2. Click Action menu
  3. Press New workflow button
  4. Search Jekyll
  5. Find the workflow named Jekyll and click Configure button
  6. Press Commit changes

You may need to pull and push from your local repository to sync with the commit.

The workflow seems designed for the latest stable Jekyll. It uses Jekyll 4.3.3.