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

Error when using middleman-search with directory indexes #90

Open
lask79 opened this issue Nov 28, 2018 · 0 comments
Open

Error when using middleman-search with directory indexes #90

lask79 opened this issue Nov 28, 2018 · 0 comments

Comments

@lask79
Copy link

lask79 commented Nov 28, 2018

In my current setup I am trying to use middleman-search together with directory indexes and asciidoc.

While using that I am getting this error:
undefined method destination_path' for nil:NilClass C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/middleman-asciidoc-1.0.0/lib/middleman-asciidoc/template.rb:14:in prepare'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/tilt-2.0.8/lib/tilt/template.rb:99:in initialize' C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/tilt-2.0.8/lib/tilt/mapping.rb:138:in new'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/tilt-2.0.8/lib/tilt/mapping.rb:138:in new' C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/tilt-2.0.8/lib/tilt.rb:43:in new'

The problem is that the current page that needs to be rendered by asciidoc is not having a resource but only the :current_path. middleman-search runs through the sitemap and renderes all found resources like this:

https://github.com/manastech/middleman-search/blob/master/lib/middleman-search/search-index-resource.rb

html = resource.render( { :layout => false }, { :current_path => resource.path } )
Nokogiri::HTML(html).xpath("//text()").text

The problem is that some of the resources in the sitemap are not found by the TemplateContext.current_resource by the :current_path when directory index is used.

Is it possible to change the middleman-asciidoc to render also by the provided path and not by calling resource.destination_path anymore when there is no resource?

Regards
Lasse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant