Skip to content

Commit e5f8795

Browse files
authored
[permalink] Ensure that the permalink is correctly set #199 (#200)
It ensures that the permalink_lang attribute is set correctly and can be used when a permalink attribute is set at the site level. It is, indeed, not enough to check if the permalink is undefined. The permalink might be set to empty. Moreover, we should check that the page has a lang attribute isn't empty as well.
1 parent 9196b96 commit e5f8795

File tree

1 file changed

+2
-2
lines changed
  • lib/jekyll/polyglot/patches/jekyll

1 file changed

+2
-2
lines changed

lib/jekyll/polyglot/patches/jekyll/site.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def coordinate_documents(docs)
138138
lang_exclusive = doc.data['lang-exclusive'] || []
139139
url = doc.url.gsub(regex, '/')
140140
page_id = doc.data['page_id'] || url
141-
doc.data['permalink'] = url unless defined?(doc.data['permalink'])
141+
doc.data['permalink'] = url if doc.data['permalink'].to_s.empty? && !doc.data['lang'].to_s.empty?
142142

143143
# skip entirely if nothing to check
144144
next if @file_langs.nil?
@@ -185,7 +185,7 @@ def assignPageLanguagePermalinks(doc, docs)
185185
end
186186
end
187187

188-
# performs any necesarry operations on the documents before rendering them
188+
# performs any necessary operations on the documents before rendering them
189189
def process_documents(docs)
190190
# return if @active_lang == @default_lang
191191

0 commit comments

Comments
 (0)