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

Static file in collection (with permalink set) causes build to fail #7904

Closed
joeshannon opened this issue Nov 18, 2019 · 3 comments · Fixed by #7908
Closed

Static file in collection (with permalink set) causes build to fail #7904

joeshannon opened this issue Nov 18, 2019 · 3 comments · Fixed by #7908
Labels
frozen-due-to-age has-pull-request Somebody suggested a solution to fix this issue
Milestone

Comments

@joeshannon
Copy link
Contributor

joeshannon commented Nov 18, 2019

With the latest Jekyll version (4) a collection containing a static file causes the build to break when a permalink is set on the collection.

My Environment

Software Version(s)
Operating System Linux
jekyll Latest
github-pages No

Expected Behaviour

The static file should be copied into _site and build should succeed.

(Alternatively if there really is a problem a meaningful error message should be given.)

Current Behavior

Jekyll build fails with stack trace. Example repository here:
https://github.com/joeshannon/jekyll-collection-static-issue

Code Sample

https://github.com/joeshannon/jekyll-collection-static-issue

@ashmaroli
Copy link
Member

Thank you for reporting this bug. Though this issue only occurs if the static file doesn't have an extension.

@ashmaroli
Copy link
Member

Workaround

Until a proper patch is shipped, you may use the following workaround by pasting the code in a file at the path <source_dir>/_plugins/monkey_patch.rb

# frozen_string_literal: true

module Jekyll
  class StaticFile
    def placeholders
      {
        :collection => @collection.label,
        :path       => cleaned_relative_path,
        :output_ext => "",
        :name       => basename,
        :title      => "",
      }
    end
  end
end

@joeshannon
Copy link
Contributor Author

No problem, thanks for providing a workaround.

@jekyllbot jekyllbot added the has-pull-request Somebody suggested a solution to fix this issue label Nov 25, 2019
@DirtyF DirtyF added this to the 4.1 milestone Nov 25, 2019
@jekyll jekyll locked and limited conversation to collaborators Apr 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
frozen-due-to-age has-pull-request Somebody suggested a solution to fix this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants