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 building sitemap based on dynamic directories #1

Open
lunks opened this issue Mar 29, 2014 · 2 comments
Open

Error when building sitemap based on dynamic directories #1

lunks opened this issue Mar 29, 2014 · 2 comments

Comments

@lunks
Copy link

lunks commented Mar 29, 2014

Hi, I have the following on my config.rb:

data.companies.each do |name, company|
  proxy "/companies/#{name}/index.html", "/company_page.html",
    locals: { company: company }
end

Whenever I run middleman build, when trying to build the sitemap I get:

/opt/boxen/rbenv/versions/2.1.0/lib/ruby/2.1.0/uri/generic.rb:824:in `check_path': bad component(expected absolute path component): /companies/01zv/.html (URI::InvalidComponentError)
    from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/2.1.0/uri/generic.rb:871:in `path='
    from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/bundler/gems/middleman-sitemap-62a9ba786be5/lib/middleman-sitemap/extension.rb:95:in `urlencode'
    from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/bundler/gems/middleman-sitemap-62a9ba786be5/templates/sitemap.xml.erb:5:in `block (2 levels) in singleton class'
    from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/bundler/gems/middleman-sitemap-62a9ba786be5/templates/sitemap.xml.erb:3:in `each'
    from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/bundler/gems/middleman-sitemap-62a9ba786be5/templates/sitemap.xml.erb:3:in `block in singleton class'
    from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/bundler/gems/middleman-sitemap-62a9ba786be5/templates/sitemap.xml.erb:-5:in `instance_eval'
    from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/bundler/gems/middleman-sitemap-62a9ba786be5/templates/sitemap.xml.erb:-5:in `singleton class'
    from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/bundler/gems/middleman-sitemap-62a9ba786be5/templates/sitemap.xml.erb:-7:in `__tilt_70131942349800'
    from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/tilt-1.4.1/lib/tilt/template.rb:170:in `call'
    from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/tilt-1.4.1/lib/tilt/template.rb:170:in `evaluate'
    from /opt/boxen/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'

PS: Using master to build.

@statonjr
Copy link
Owner

The error indicates that the URI is invalid. I ran into this issue, too, and had to encode the names before the URI library will accept it. You may want to try htmlentities: https://github.com/threedaymonk/htmlentities

@lunks
Copy link
Author

lunks commented Mar 29, 2014

The problem seems to be that encoding this URL (which include backslashes) generates an invalid URI in the end.

i.e. /companies/01zv/ becomes what you see in the output.

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

2 participants