mirror of
https://github.com/olivierlacan/keep-a-changelog.git
synced 2025-07-30 09:14:12 +02:00
Greatly simplify default version redirection
Can’t believe I didn’t think of it sooner but obviously we might as well check all available version for each language and redirect by default to the latest possible. Now I’ll have to figure out a way to display when the latest available version *for a language* isn’t the latest version of the manifesto (so if it doesn’t match the latest English version).
This commit is contained in:
parent
714fc86f5c
commit
4af96a47b1
15
config.rb
15
config.rb
@ -3,7 +3,11 @@
|
||||
# --------------------------------------
|
||||
|
||||
# ----- Site ----- #
|
||||
$last_version = "0.3.0"
|
||||
# Last version should be the latest English version since the manifesto is first
|
||||
# written in English, then translated into other languages later.
|
||||
$last_version = (Dir.entries("source/en") - %w[. ..]).last
|
||||
|
||||
# This list of languages populates the language navigation.
|
||||
$languages = {
|
||||
"cs" => "Čeština",
|
||||
"de" => "Deutsch",
|
||||
@ -32,13 +36,8 @@ redirect "index.html", to: "en/#{$last_version}/index.html"
|
||||
|
||||
$languages.each do |language|
|
||||
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
|
||||
versions = Dir.entries("source/#{code}") - %w[. ..]
|
||||
redirect "#{code}/index.html", to: "#{code}/#{versions.last}/index.html"
|
||||
end
|
||||
|
||||
# ----- Assets ----- #
|
||||
|
Loading…
x
Reference in New Issue
Block a user