jekyll / jekyll-admin

A Jekyll plugin that provides users with a traditional CMS-style graphical interface to author content and administer Jekyll sites.
https://jekyll.github.io/jekyll-admin/
MIT License
2.83k stars 359 forks source link

wrong configuration_path with non-default jekyll source #422

Open krodelabestiole opened 6 years ago

krodelabestiole commented 6 years ago

Hello

I cannot access /admin url after having launched the "serve" command (error 500) and I get this message : Errno::ENOENT - No such file or directory @ rb_sysopen - /path/to/my/website/src/_config.yml: /var/lib/gems/2.3.0/gems/jekyll-admin-0.7.0/lib/jekyll-admin/server/configuration.rb:36:in 'read'

I have to mention that I've changed the jekyll source path to "src" (and destination to "dist"). I find it cleaner this way. Still, I see no reason for jekyll-admin to look for the _config.yml file in the source path /path/to/my/website/src/_config.yml, since it is in the project root /path/to/my/website/_config.yml.

sorry I don't know ruby. How could I fix this issue ?

krodelabestiole commented 6 years ago

everything works fine when I define my path the hard way :

# Returns the path to the *first* config file discovered
      def configuration_path
        "/path/to/my/website/_config.yml"
        # sanitized_path configuration.config_files(overrides).first
      end

but I can't change it the good way since I don't understand this line : sanitized_path configuration.config_files(overrides).first (line 44 in configuration.rb)

jekyllbot commented 6 years ago

This issue has been automatically marked as stale because it has not been commented on for at least two months.

The resources of the Jekyll team are limited, and so we are asking for your help.

If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.

If this is a feature request, please consider whether it can be accomplished in another way. If it cannot, please elaborate on why it is core to this project and why you feel more than 80% of users would find this beneficial.

This issue will automatically be closed in two months if no further activity occurs. Thank you for all your contributions.

jameysharp commented 6 years ago

I have the same issue with jekyll-admin 0.8.0 and the setting source: src in my _config.yml, which is at top-level.

As a workaround, things seem to work fine if I symlink src/_config.yml to the top-level copy.

lkjimy commented 6 years ago

I have the same problem. We all have basically the same folder structure. Same issue as #451. @jameysharp How do you make the symlink to the root level config? I had to copy the config file to the "src" folder, i suppose you did that too. I don't know how the symlink works.

XhmikosR commented 5 years ago

Any news on this? I also hit this since I never keep the src files in root.

ashmaroli commented 4 years ago

I'm afraid this can't be satisfactorily resolved because Jekyll doesn't have a notion of project root. Jekyll has always looked for config files at the root of the configured source directory.

Here's an excerpt from Jekyll's source code:

      # Get configuration from <source>/_config.yml or <source>/<config_file>
      config_files = override["config"]
      if config_files.to_s.empty?
        default = %w(yml yaml toml).find(-> { "yml" }) do |ext|
          File.exist?(Jekyll.sanitized_path(source(override), "_config.#{ext}"))
        end
        config_files = Jekyll.sanitized_path(source(override), "_config.#{default}")
        @default_config_file = true
      end
      Array(config_files)