title: Middleman and relative images
body: <p>For some reason my Middleman blog isn't producing the correct url from my relative image link for one of my directories and I can't for the life of me figure out where it's going wrong.</p>
  
  <p>So my build directory is like so</p>
  
  <pre><code>build
  -software
   --article1
    ---index.html
   --article2
   --article3
  -design
  -reviews
  -misc
  -images
  -stylesheets
  -tags
  </code></pre>
  
  <p>Relative path works for pretty much everything, example I linked to an image in software's article1. Markdown code is <code>![test](test.jpg)</code> And the html reads <code>"../../images/test.jpg"</code></p>
  
  <p>However when I made a blog post in design, that article's associated html read as <code>"/images/test.jpg"</code> despite using the same markdown. I have no clue why it's doing that for all posts within design.</p>
  
  <p>Upon further testing, apparently it will not produce the right code if there is only one post within any particular folder, so make sure I was still sane, I duplicated the post only changing the date and the second resulting html produced the correct relative path, it also updated the original and gave it the correctly parsed relative path as well. But when I deleted the duplicate it updated the remaining and changed it back to <code>"images/test.jpg"</code></p>
  
  <p>My config file if needed.</p>
  
  <pre><code>###
  # Blog settings
  ###
  
  Time.zone = "EST"
  activate :syntax
  set :fonts_dir,  "fonts-folder"
  set :markdown_engine, :redcarpet
  set :markdown,  :fenced_code_blocks =&gt; true,
                  :smartypants =&gt; true,
                  :tables =&gt; true,
                  :highlight =&gt; true,
                  :with_toc_data =&gt; true
  
  activate :blog do |blog|
    blog.custom_collections = {
      category: {
        link: '{category}.html',
        template: 'category.html'
      }
    }
    # This will add a prefix to all links, template references and source paths
    # blog.prefix = "{category}"
    blog.name = "blog"
    blog.permalink = "{category}/{title}.html"
    blog.sources = "{category}/{title}.html"
    #blog.taglink = "{tag}.html"
    # blog.layout = "layout"
    blog.summary_separator = /(READMORE)/
    blog.summary_length = 185
    # blog.year_link = "{year}.html"
    # blog.month_link = "{year}/{month}.html"
    # blog.day_link = "{year}/{month}/{day}.html"
    # blog.default_extension = ".markdown"
  
    blog.tag_template = "tag.html"
    #blog.calendar_template = "calendar.html"
  
    # Enable pagination
    # blog.paginate = true
    # blog.per_page = 10
    # blog.page_link = "page/{num}"
  end
  
  activate :deploy do |deploy|
    deploy.method = :git
    deploy.branch = 'master'
    deploy.build_before = true
    deploy.commit_message = "New blog entry go!"
  end
  
  activate :minify_html do |html|
    html.remove_multi_spaces        = true
    html.remove_comments            = true
  end
  
  
  activate :directory_indexes
  page "/feed.xml", layout: false
  
  ###
  # Compass
  ###
  
  # Change Compass configuration
  # compass_config do |config|
  #   config.output_style = :compact
  # end
  
  ###
  # Page options, layouts, aliases and proxies
  ###
  
  # Per-page layout changes:
  #
  # With no layout
  # page "/path/to/file.html", layout: false
  #
  # With alternative layout
  # page "/path/to/file.html", layout: :otherlayout
  #
  # A path which all have the same layout
  # with_layout :admin do
  #   page "/admin/*"
  # end
  
  # Proxy pages (http://middlemanapp.com/basics/dynamic-pages/)
  # proxy "/this-page-has-no-template.html", "/template-file.html", locals: {
  #  which_fake_page: "Rendering a fake page with a local variable" }
  
  ###
  # Helpers
  ###
  
  # Automatic image dimensions on image_tag helper
   #activate :automatic_image_sizes
  
  
  set :css_dir, 'stylesheets'
  set :js_dir, 'javascripts'
  set :images_dir, 'images'
  activate :livereload
  
  # Build-specific configuration
  configure :build do
    activate :minify_css
    activate :relative_assets
  
    # Or use a different image path
    # set :http_prefix, "/Content/images/"
  end
  </code></pre>