Skip to content

Commit

Permalink
Document how to adjust for a baseurl
Browse files Browse the repository at this point in the history
Fixes #618
  • Loading branch information
PeterJCLaw committed Oct 18, 2021
1 parent 9c8309f commit e8cd5a1
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions README.md
Expand Up @@ -217,6 +217,31 @@ Don't have or want a `Rakefile`? You can also do something like the following:
htmlproofer --assume-extension ./_site
```

#### Adjusting for a `baseurl`

If your Jekyll site has a `baseurl` configured, you'll need to adjust the
generated url validation to cope with that. The easiest way is using the
`url_swap` option.

For a `site.baseurl` value of `/BASEURL`, here's what that looks like on the
command line:

```bash
htmlproofer --assume-extension ./_site --url-swap '^/BASEURL/:/'
```

or in your `Rakefile`

```ruby
require 'html-proofer'

task :test do
sh "bundle exec jekyll build"
options = { :assume_extension => true, :url_swap => "^/BASEURL/:/" }
HTMLProofer.check_directory("./_site", options).run
end
```

### Using through Docker

If you have trouble with (or don't want to) install Ruby/Nokogumbo, the command-line tool can be run through Docker. See [klakegg/html-proofer](https://hub.docker.com/r/klakegg/html-proofer) for more information.
Expand Down

0 comments on commit e8cd5a1

Please sign in to comment.