@@ -15,6 +15,10 @@ def generate(site)
1515 versions . each { |version |
1616 mapping [ 'version' ] = version
1717 site . pages << RedirectPage . new ( site , redirect_config [ 0 ] , redirect_config [ 1 ] , mapping )
18+ if version == latest_release
19+ mapping [ 'landing_version' ] = "latest"
20+ site . pages << RedirectPage . new ( site , redirect_config [ 0 ] , redirect_config [ 1 ] , mapping )
21+ end
1822 }
1923 end
2024 Jekyll . logger . info "Generated redirects #{ redirect_config [ 0 ] } "
@@ -34,20 +38,20 @@ def known_releases(site)
3438
3539 # Subclass of `Jekyll::Page` with custom method definitions.
3640 class RedirectPage < Jekyll ::Page
37- def initialize ( site , group , redirectConfig , mapping )
41+ def initialize ( site , group , redirect_config , mapping )
3842
3943 @site = site # the current site instance.
4044 @base = site . source # path to the source directory.
41- @dir = "/redirect/#{ group } /#{ mapping [ 'version' ] } /" # the directory the page will reside in.
45+ @dir = "/redirect/#{ group } /#{ mapping [ 'landing_version' ] || mapping [ ' version'] } /" # the directory the page will reside in.
4246
4347 # All pages have the same filename, so define attributes straight away.
4448 @basename = mapping [ 'name' ] # filename without the extension.
4549 @ext = '.html' # the extension.
4650 @name = basename + ext # basically @basename + @ext.
4751 @layout = 'redirect.html'
48- delay = redirectConfig [ 'delay' ] ||= 1
52+ delay = redirect_config [ 'delay' ] ||= 1
4953 @data = {
50- 'target' => "#{ redirectConfig [ 'baseUrl' ] } #{ mapping [ 'version' ] } #{ mapping [ 'path' ] } " ,
54+ 'target' => "#{ redirect_config [ 'baseUrl' ] } #{ mapping [ 'version' ] } #{ mapping [ 'path' ] } " ,
5155 'layout' => 'redirect' ,
5256 'delay' => "#{ delay } " ,
5357 }
0 commit comments