Skip to content

Commit

Permalink
fix empty description, invalid educationalLevel term
Browse files Browse the repository at this point in the history
  • Loading branch information
hexylena committed Jun 25, 2024
1 parent 3ccc3d8 commit cbbd19c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions _plugins/jekyll-jsonld.rb
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,10 @@ def generate_material_jsonld(material, topic, site)
})
end
end

if description.empty?
description.push(material.fetch('content', '').strip.split("\n").first)
end
data['description'] = description.join("\n")

data['inLanguage'] = if material.key?('lang')
Expand Down Expand Up @@ -964,9 +968,9 @@ def generate_material_jsonld(material, topic, site)

data['about'] = about

data['educationalLevel'] = material.key?('level') ? eduLevel[material['level']] : 'Introductory'
data['educationalLevel'] = material.key?('level') ? eduLevel[material['level']] : 'Beginner'
data['mentions'] = (material['tags'] || []).map { |x| { '@type': 'Thing', name: x } }
data['abstract'] = material.fetch('content', '').split("\n").first
data['abstract'] = material.fetch('content', '').strip.split("\n").first

data
end
Expand Down

0 comments on commit cbbd19c

Please sign in to comment.