diff --git a/lib/jekyll/url.rb b/lib/jekyll/url.rb index f0c1e602..7dd8cfe7 100644 --- a/lib/jekyll/url.rb +++ b/lib/jekyll/url.rb @@ -37,33 +37,20 @@ module Jekyll # # Returns the String URL def to_s - sanitize_url(generate_permalink_url || generate_url) + sanitize_url(generate_url) end # Internal: Generate the URL by replacing all placeholders with their - # respective values in the template + # respective values in the template or permalink # # Returns the _unsanitizied_ String URL def generate_url - @placeholders.inject(@template) do |result, token| + @placeholders.inject(@permalink || @template) do |result, token| break result if result.index(':').nil? result.gsub(/:#{token.first}/, self.class.escape_path(token.last)) end end - # Internal: Generate the URL by replacing all placeholders with their - # respective values in the permalink - # - # Returns the _unsanitizied_ String URL - def generate_permalink_url - if not @permalink.nil? - @placeholders.inject(@permalink) do |result, token| - break result if result.index(':').nil? - result.gsub(/:#{token.first}/, self.class.escape_path(token.last)) - end - end - end - # Returns a sanitized String URL def sanitize_url(in_url) url = in_url \