Respect user-defined name attribute in documents (#9167)

Merge pull request 9167
This commit is contained in:
Ashwin Maroli
2022-10-26 22:06:32 +05:30
committed by GitHub
parent 390b1f006b
commit 7206b7f9ef
5 changed files with 31 additions and 2 deletions

View File

@@ -12,7 +12,6 @@ module Jekyll
mutable false
delegate_method_as :relative_path, :path
delegate_method_as :basename, :name
private delegate_method_as :data, :fallback_data
delegate_methods :id, :output, :content, :to_s, :relative_path, :url, :date
@@ -26,6 +25,10 @@ module Jekyll
fallback_data["excerpt"].to_s
end
def name
fallback_data["name"] || @obj.basename
end
def <=>(other)
return nil unless other.is_a? DocumentDrop

View File

@@ -16,7 +16,7 @@ module Jekyll
end
def name
@obj.doc.basename
@obj.doc.data["name"] || @obj.doc.basename
end
end
end