From 3a7298570a6c3887a8038204213c8673f6079a78 Mon Sep 17 00:00:00 2001 From: Olivier Lacan Date: Fri, 15 Feb 2019 12:03:30 -0500 Subject: [PATCH] Prevent 1.1.0 from being $latest_version for now We don't quite yet want to redirect to this version although it will be good to be able to test it. # Title # Tell me everything! # Co-authors (they will be credited on GitHub as well) # Co-authored-by: Carolina Powers # Co-authored-by: Meg Kline-Tuls # Co-authored-by: Will # Co-authored-by: thatchej --- config.rb | 7 +++++-- source/en/1.1.0/index.html.haml | 2 +- source/layouts/layout.html.haml | 9 +++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/config.rb b/config.rb index f3981d7..49bbe5f 100644 --- a/config.rb +++ b/config.rb @@ -5,8 +5,11 @@ # ----- Site ----- # # Last version should be the latest English version since the manifesto is first # written in English, then translated into other languages later. -$versions = (Dir.entries("source/en").sort - %w[. ..]) -$last_version = $versions.last +$versions = Dir.glob("source/en/*").map{ |e| e.sub("source/en/","") }.sort +# NOTE: for now, while 1.1.0 is in development let's pin the latest +# version to 1.0.0 manually. +# $last_version = $versions.last +$last_version = "1.0.0" $previous_version = $versions[$versions.index($last_version) - 1] # This list of languages populates the language navigation. diff --git a/source/en/1.1.0/index.html.haml b/source/en/1.1.0/index.html.haml index e8c3b03..eb18848 100644 --- a/source/en/1.1.0/index.html.haml +++ b/source/en/1.1.0/index.html.haml @@ -2,7 +2,7 @@ description: Keep a Changelog title: Keep a Changelog language: en -version: 1.0.0 +version: 1.1.0 --- - changelog = "https://github.com/olivierlacan/keep-a-changelog/blob/master/CHANGELOG.md" diff --git a/source/layouts/layout.html.haml b/source/layouts/layout.html.haml index 90c3fc9..4d85c0c 100644 --- a/source/layouts/layout.html.haml +++ b/source/layouts/layout.html.haml @@ -1,5 +1,6 @@ // Variables - latest_version = current_page.metadata[:page][:version] == $last_version +- legacy_version = current_page.metadata[:page][:version] < $last_version - language_code = current_page.metadata[:page][:language] - versions = Dir.entries("source/#{language_code}") - %w[. ..] - current_version = current_page.metadata[:page][:version] @@ -32,10 +33,10 @@ %link{ rel: "stylesheet", href: "https://fonts.googleapis.com/css?family=Muli:400,700" } = stylesheet_link_tag '//fonts.googleapis.com/css?family=Source+Code+Pro:400,700' - - if latest_version - = stylesheet_link_tag 'application' - - else + - if legacy_version = stylesheet_link_tag 'legacy' + - else + = stylesheet_link_tag 'application' = javascript_include_tag 'all', defer: true %body @@ -52,7 +53,7 @@ = available_translation .main{ role: "main" } - - if !latest_version + - if !latest_version && legacy_version - if versions.include?($last_version) %p.newer - if $languages[language_code][:new]