Skip to content

Commit

Permalink
Fix double slashes on site index page
Browse files Browse the repository at this point in the history
  • Loading branch information
samrayner committed Oct 28, 2013
1 parent c9ed53d commit 45256c7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions asset_path_tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,18 @@ def render(context)
#loop through posts to find match and get slug
context.registers[:site].posts.each do |post|
if post.id == page["id"]
path = "/posts/#{post.slug}"
path = "posts/#{post.slug}"
end
end
else
path = page["url"].sub(/\/$/, "")
path = page["url"]
end

#strip filename
path = File.dirname(path) if path =~ /\.\w+$/

"/assets#{path}/#{@filename}"
#fix double slashes
"/assets/#{path}/#{@filename}".gsub(/\/{2,}/, '/')
end
end
end
Expand Down

0 comments on commit 45256c7

Please sign in to comment.