Class: Jekyll::Page

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll/static_file_ext.rb

Instance Method Summary collapse

Instance Method Details



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/jekyll/static_file_ext.rb', line 30

def update_permalink
  # If URL already ends with '/', it's a directory URL and should be used as-is
  # Otherwise, extract the directory from the file URL
  target_dir = url.end_with?("/") ? url : File.dirname(url) + "/"

  data["permalink"] = target_dir
  @url = URL.new(
    :template     => template,
    :placeholders => url_placeholders,
    :permalink    => permalink
  ).to_s
end