All asset links are wrong on build

i have built my middleman protect and all the asset links to the css, js and images are broken

this is the code for an image

<%= image_tag "pillar-box-lettings-logo.svg" %>

and the html it creates is

<img src="/images/pillar-box-lettings-logo.svg" alt="Pillar box lettings logo">

however on my site when i upload the files the image does not show, but if you remove the first “/” it does.

so how can i fix this as the image tag and stylesheet links are default in middleman when you create a new project.

Are you hosting it on GitHub pages or something similar? If you are, it will be looking for files at

something.github.io/pillar-box-lettings-logo.svg

Instead of

something.github.io/something/pillar-box-lettings-logo.svg

In order to make all of your links relative, add to your config.rb:

set :relative_links, true

To only change a single link, replace

<%= image_tag "pillar-box-lettings-logo.svg" %>

with

<%= image_tag "pillar-box-lettings-logo.svg", relative: true %>

More information found:

this is my config file

activate :autoprefixer

set :css_dir, "assets/css"
set :js_dir, "assets/js"
set :images_dir, "assets/images"
set :fonts_dir, "assets/fonts"
set :layout, "layouts/application"


page '/*.xml', layout: false
page '/*.json', layout: false
page '/*.txt', layout: false

configure :development do
   activate :livereload
end

configure :build do
  activate :relative_assets
  set :relative_links, true
  activate :minify_css
  activate :minify_javascript
end

but the relative links is not working there is no forward slash at the beginning of css and js links

<script src="assets/js/application.js"></script>

rather than

<script src="/assets/js/application.js"></script>

any ideas?