Add next_course data

parent 273a7f6f
Pipeline #547 failed with stage
in 1 minute and 9 seconds
...@@ -24,6 +24,9 @@ module Jekyll ...@@ -24,6 +24,9 @@ module Jekyll
# set course slug # set course slug
course_data["slug"] = /^\/courses\/(.+)\/$/.match(page.dir)[1] course_data["slug"] = /^\/courses\/(.+)\/$/.match(page.dir)[1]
# set url
course_data["url"] = page.dir
# get data from page # get data from page
course_data["name"] = page.data["course"]["name"] course_data["name"] = page.data["course"]["name"]
course_data["logo"] = page.data["course"]["logo"] course_data["logo"] = page.data["course"]["logo"]
...@@ -47,9 +50,6 @@ module Jekyll ...@@ -47,9 +50,6 @@ module Jekyll
course_data["editions_count"] = course_data["editions"].size course_data["editions_count"] = course_data["editions"].size
course_data["past_editions_count"] = course_data["past_editions"].size course_data["past_editions_count"] = course_data["past_editions"].size
#debug
#site.pages.select { |p| p.name == course_data["slug"] + ".json" }.each { |p| p.data["course"] = course_data }
# add information to the course's page # add information to the course's page
page.data["course"] = course_data page.data["course"] = course_data
...@@ -78,6 +78,9 @@ module Jekyll ...@@ -78,6 +78,9 @@ module Jekyll
@logger.error("Error occurs during #{page.data["course"]["name"]} course pages creation") @logger.error("Error occurs during #{page.data["course"]["name"]} course pages creation")
end end
end end
# get the next course
site.data["next_course"] = site.data["courses"].select { |c| !c["is_past"] }.last
end end
def make_past_editions_page(site, dir, course_data) def make_past_editions_page(site, dir, course_data)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment