Skip to content

Commit

Permalink
Add latest.json (#2078)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcwrobel committed Jan 3, 2023
1 parent 94a30d7 commit 2c1712f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions _plugins/generate-api-v1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def generate(site)
site.pages << product_page
all_products << product_page

site.pages << ProductCycleJson.new(site, page, page.data['releases'][0], 'latest')
page.data['releases'].each do |cycle|
site.pages << ProductCycleJson.new(site, page, cycle)
end
Expand Down Expand Up @@ -71,14 +72,14 @@ def initialize(site, product)
end

class ProductCycleJson < Jekyll::Page
def initialize(site, product, cycle)
def initialize(site, product, cycle, identifier=nil)
product_id = product.data['permalink'][1..product.data['permalink'].length]
cycle_id = cycle['releaseCycle'].tr('/', '-')

@site = site
@base = site.source
@dir = "api/v1/#{product_id}/cycles/#{cycle_id}"
@name = "index.json"
@dir = "api/v1/#{product_id}/cycles/#{identifier ? identifier : cycle_id}"
@name = 'index.json'

@data = {}.merge(cycle)
@data['layout'] = 'v1_cycle'
Expand Down

0 comments on commit 2c1712f

Please sign in to comment.