Skip to content

Commit

Permalink
[permalink] Ensure that the permalink is correctly set #199 (#200)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hacketiwack authored Aug 16, 2024
1 parent 9196b96 commit e5f8795
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/jekyll/polyglot/patches/jekyll/site.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def coordinate_documents(docs)
lang_exclusive = doc.data['lang-exclusive'] || []
url = doc.url.gsub(regex, '/')
page_id = doc.data['page_id'] || url
doc.data['permalink'] = url unless defined?(doc.data['permalink'])
doc.data['permalink'] = url if doc.data['permalink'].to_s.empty? && !doc.data['lang'].to_s.empty?

# skip entirely if nothing to check
next if @file_langs.nil?
Expand Down Expand Up @@ -185,7 +185,7 @@ def assignPageLanguagePermalinks(doc, docs)
end
end

# performs any necesarry operations on the documents before rendering them
# performs any necessary operations on the documents before rendering them
def process_documents(docs)
# return if @active_lang == @default_lang

Expand Down

0 comments on commit e5f8795

Please sign in to comment.