Skip to content

Many relative links are broken (because Github Pages adds trailing slashes) #188

@danieldiekmeier

Description

@danieldiekmeier

Hello! I recently submitted the PR #187 that fixed a few relative links on the website.

After, I wondered if there were any more. I checked out the repo, started middleman and ran broken-link-checker. I was surprised to find: It reported the exact links that I just fixed.

Indeed: Due to the fact that middleman does NOT add trailing slashes to paths, but Github Pages does, the website works perfectly fine in development, but not in production.

I installed Rack Rewrite and added this to the config.rb to sync the behaviour:

require 'rack/rewrite'

configure :development do
  use ::Rack::Rewrite do
    # add trailing slash, like Github Pages
    r301 %r{/features/(.*)}, '/features/$1/', not: %r{/$}
  end
end

I ran the broken-link-checker again, and this time, it found links that were really broken, around ~75. I think they all have the same problem, that don't account for the trailing slash.

I was wondering if it would make sense to fix these in a PR or not? I noticed that the markdown files basically mirror the files in the repo: https://github.com/rspec/rspec-rails/blob/main/features/controller_specs/README.md so I'd guess that it doesn't make sense to edit all the files here manually?

I'd be happy to help, but I think I need someone to point me in the right direction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions