Open necopinus opened 6 years ago
I have this same exact problem - I created the layout category-view.html
inside my theme gem and configured autopages to use it for categories and tags.
When trying to build the site, I get a whole bunch of error messages:
Error reading file PATH_TO_SITE/_layouts/category-view.html: No such file or directory @ rb_sysopen - PATH_TO_SITE/_layouts/category-view.html
I'm getting the same errors for tags, categories, and collections.
AutoPages: Generating tags pages
Error reading file /_layouts/archive.html: No such file or directory @ rb_sysopen - /_layouts/archive.html
AutoPages: Generating categories pages
Error reading file /_layouts/archive.html: No such file or directory @ rb_sysopen - /_layouts/archive.html
AutoPages: Generating collections pages
Error reading file /_layouts/portfolio-archive.html: No such file or directory @ rb_sysopen - /_layouts/portfolio-archive.html
Any idea on time frame for a fix?
I hacked this to make it work while using remote themes-
+1 would be good to have a fix for this :)
Have done a bit of investigation, the issue occurs in this line while initialising a BaseAutoPage
:
self.read_yaml(File.join(site.source, layout_dir), layout_name)
Looking more closely at the Convertible.read_yaml
method (code here):
def read_yaml(base, name, opts = {})
filename = @path || site.in_source_dir(base, name)
Jekyll.logger.debug "Reading:", relative_path
begin
self.content = File.read(filename, **Utils.merged_file_read_opts(site, opts))
...
read_yaml
will either use @path
or look in the site's source dir to read a given file. But in order for read_yaml
to read a layout that lives in a theme directory, we'd have to set the page @path
to the theme layouts directory (which seems ugly and might lead to unexpected behaviour).
The layout is already passed through further down in the BaseAutoPage.initialise
method in this line:
self.data['layout'] = File.basename(layout_name, File.extname(layout_name))
and this will load a theme layout fine because the renderer later looks in site.layouts
where any theme layouts have been made available.
Given that it's not required to load the layout, is there a particular reason that read_yaml
is being called here that I may have missed? @sverrirs
I hacked this to make it work while using remote themes-
203
I'm currently developing my own gem theme and since I'm developing locally, using gem "myTheme", :path => "../myTheme/" the remote theme hack won't work. I'd hate to miss some important error getting drowned out by the flood of tag errors that aren't "real"
I'm currently working on a Jekyll theme, and have discovered while testing that
jekyll-paginate-v2
doesn't properly pick up layouts outside of the site-wide_layouts
directory.Current Behavior: Suppose my theme includes the following files:
Running
bundle exec jekyll serve
will cause AutoPages to complain that the relevant default layouts cannot be found. Copying these into my site's_layouts
folder works as expected.Expected Behavior: If a layout is included in a theme but not in the site's
_layouts
folder, use the theme's layout. This would bringjekyll-paginate-v2
's behavior w.r.t. layouts in line with other Jekyll plugins (such asjekyll-archives
).