mirror of
https://github.com/olivierlacan/keep-a-changelog.git
synced 2025-07-29 16:54:12 +02:00
Only default to last version if available
It's quite possible that not all languages will be on the latest version of the manifesto at the same time. This allows me to fight inertia by simply defaulting each version to the latest possible version.
This commit is contained in:
parent
57bd08f9b8
commit
714fc86f5c
10
config.rb
10
config.rb
@ -31,8 +31,14 @@ set :site_url, 'http://keepachangelog.com'
|
||||
redirect "index.html", to: "en/#{$last_version}/index.html"
|
||||
|
||||
$languages.each do |language|
|
||||
language_param = language.last.parameterize
|
||||
redirect "#{language.first}/index.html", to: "#{language.first}/#{$last_version}/index.html"
|
||||
code = language.first
|
||||
available_versions = Dir.entries("source/#{code}") - %w[. ..]
|
||||
|
||||
if Dir.exists?("source/#{code}/#{$last_version}")
|
||||
redirect "#{code}/index.html", to: "#{code}/#{$last_version}/index.html"
|
||||
else
|
||||
redirect "#{code}/index.html", to: "#{code}/#{available_versions.last}/index.html"
|
||||
end
|
||||
end
|
||||
|
||||
# ----- Assets ----- #
|
||||
|
Loading…
x
Reference in New Issue
Block a user