我在Jekyll网站上有一个writing
集合,我将output
设置为true,因为我希望呈现所有.md
和.html
个文件。但是,还有一些.js
和.css
文件,我希望Jekyll能够正常使用。
我收到此错误
undefined method `data' for #<Jekyll::StaticFile:0x00000104d8bb70>
我相信它是因为Jekyll正在尝试解析js / css文件。
是否可以在我的馆藏中正常提供静态文件?
更新以下是完整的跟踪:
Configuration file: project/_config.yml
Source: project
Destination: project/_site
Generating...
Unable to find a valid configuration: sass_path=project/_compass
~/.rvm/rubies/ruby-2.1.1/lib/ruby/gems/2.1.0/gems/jekyll-redirect-from-0.6.2/lib/jekyll-redirect-from/redirector.rb:38:in `has_alt_urls?': undefined method `data' for #<Jekyll::StaticFile:0x000001035f8f58> (NoMethodError)
from ~/.rvm/rubies/ruby-2.1.1/lib/ruby/gems/2.1.0/gems/jekyll-redirect-from-0.6.2/lib/jekyll-redirect-from/redirector.rb:14:in `block in generate_alt_urls'
from ~/.rvm/rubies/ruby-2.1.1/lib/ruby/gems/2.1.0/gems/jekyll-redirect-from-0.6.2/lib/jekyll-redirect-from/redirector.rb:13:in `each'
from ~/.rvm/rubies/ruby-2.1.1/lib/ruby/gems/2.1.0/gems/jekyll-redirect-from-0.6.2/lib/jekyll-redirect-from/redirector.rb:13:in `generate_alt_urls'
from ~/.rvm/rubies/ruby-2.1.1/lib/ruby/gems/2.1.0/gems/jekyll-redirect-from-0.6.2/lib/jekyll-redirect-from/redirector.rb:9:in `generate'
from ~/.rvm/rubies/ruby-2.1.1/lib/ruby/gems/2.1.0/gems/jekyll-2.4.0/lib/jekyll/site.rb:251:in `block in generate'
from ~/.rvm/rubies/ruby-2.1.1/lib/ruby/gems/2.1.0/gems/jekyll-2.4.0/lib/jekyll/site.rb:250:in `each'
from ~/.rvm/rubies/ruby-2.1.1/lib/ruby/gems/2.1.0/gems/jekyll-2.4.0/lib/jekyll/site.rb:250:in `generate'
from ~/.rvm/rubies/ruby-2.1.1/lib/ruby/gems/2.1.0/gems/jekyll-2.4.0/lib/jekyll/site.rb:45:in `process'
from ~/.rvm/rubies/ruby-2.1.1/lib/ruby/gems/2.1.0/gems/jekyll-2.4.0/lib/jekyll/command.rb:28:in `process_site'
from ~/.rvm/rubies/ruby-2.1.1/lib/ruby/gems/2.1.0/gems/jekyll-2.4.0/lib/jekyll/commands/build.rb:55:in `build'
from ~/.rvm/rubies/ruby-2.1.1/lib/ruby/gems/2.1.0/gems/jekyll-2.4.0/lib/jekyll/commands/build.rb:33:in `process'
from ~/.rvm/rubies/ruby-2.1.1/lib/ruby/gems/2.1.0/gems/jekyll-2.4.0/lib/jekyll/commands/build.rb:17:in `block (2 levels) in init_with_program'
from ~/.rvm/rubies/ruby-2.1.1/lib/ruby/gems/2.1.0/gems/mercenary-0.3.4/lib/mercenary/command.rb:220:in `call'
from ~/.rvm/rubies/ruby-2.1.1/lib/ruby/gems/2.1.0/gems/mercenary-0.3.4/lib/mercenary/command.rb:220:in `block in execute'
from ~/.rvm/rubies/ruby-2.1.1/lib/ruby/gems/2.1.0/gems/mercenary-0.3.4/lib/mercenary/command.rb:220:in `each'
from ~/.rvm/rubies/ruby-2.1.1/lib/ruby/gems/2.1.0/gems/mercenary-0.3.4/lib/mercenary/command.rb:220:in `execute'
from ~/.rvm/rubies/ruby-2.1.1/lib/ruby/gems/2.1.0/gems/mercenary-0.3.4/lib/mercenary/program.rb:35:in `go'
from ~/.rvm/rubies/ruby-2.1.1/lib/ruby/gems/2.1.0/gems/mercenary-0.3.4/lib/mercenary.rb:22:in `program'
from ~/.rvm/rubies/ruby-2.1.1/lib/ruby/gems/2.1.0/gems/jekyll-2.4.0/bin/jekyll:18:in `<top (required)>'
from ~/.rvm/gems/ruby-2.1.1/bin/jekyll:23:in `load'
from ~/.rvm/gems/ruby-2.1.1/bin/jekyll:23:in `<main>'
from ~/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
from ~/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'
答案 0 :(得分:4)
你通常应该能够在集合中使用静态文件,但是有一个jekyll-redirect 0.6.2 bug(ticket is here)。
如果您计划从Github页面提供网站服务,则需要添加Gemfile
source 'https://rubygems.org'
gem 'github-pages'
然后执行bundle update
。这将解决问题,因为Jekyll-redirect 0.3.1不会尝试为集合进行重定向。
将静态文件移出收集文件夹,以避免收集静态文件的错误。
如果您不需要它或仅需要一页或两页,请将其从Gemfile中删除,并通过复制重定向页面来制作所需的重定向页面。