Skip to content

Commit

Permalink
Added lesson metadata and schema.org JSON-LD rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
njall authored and rgaiacs committed Aug 2, 2018
1 parent fae42d2 commit a3ba5be
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
13 changes: 13 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ carpentry: "cp"
# Overall title for pages.
title: "Lesson Title"

#Metadata
# Here you can add metadata to describe your lesson so that people and search engines can understand what it's about. Please try to use fields from the Schema.org CreativeWork type - https://schema.org/CreativeWork
description: "This is the template description. Keep me brief (2-3 sentences)"
keywords: GitHub, Forking, Collaborative # see: https://schema.org/keywords
audience: [PostDoc students, Early Career Researchers] # see: https://schema.org/audience
license: "https://creativecommons.org/licenses/by/3.0/" # see: schema.org/license
author: [Homer Simpson, Ned Flanders] # see: https://schema.org/author
contributor: [Barney Gumball, Dr Nick Riviera] # see: https://schema.org/contributor
timeRequired: "1 hour" # see: https://schema.org/timeRequired
learningResourceType: "lesson plan" # see: https://schema.org/learningResourceType
citation: "How to cite a Training Material, John Smith et al, 2015" # see: https://schema.org/citation
dateCreated: 2016-05-01

#------------------------------------------------------------
# Generic settings (should not need to change).
#------------------------------------------------------------
Expand Down
39 changes: 39 additions & 0 deletions _includes/schema_org.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!-- Schema.org annotations in JSON-LD for a CreativeWork type.
Variables should be declared in the .md file
For full list of available attributes see https://schema.org/CreativeWork -->
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "creativeWork",
"genre": "trainingMaterial",
"name": "{{site.title}}",
"description": "{{site.description}}",
"keywords": "{{site.keywords}}",
"audience": [
{% for audience in site.audience %}{
"@type": "Audience",
"name": "{{audience}}"
}{% if forloop.last %}{%else%},{%endif%}
{% endfor %}
],
"license": "{{site.licence}}",
"author": [
{% for author in site.author %}{
"@type": "Person",
"name": "{{author}}"
}{% if forloop.last %}{%else%},{%endif%}
{% endfor %}
],
"contributor": [
{% for contributor in site.contributor %}{
"@type": "Person",
"name": "{{contributor}}"
}{% if forloop.last %}{%else%},{%endif%}
{% endfor %}
],
"timeRequired": "{{site.timeRequired}}",
"learningResourceType": "{{site.learningResourceType}}",
"citation": "{{site.citation}}",
"dateCreated" : "{{site.dateCreated}}"
}
</script>
1 change: 1 addition & 0 deletions _layouts/lesson.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
layout: base
---
{% include main_title.html %}
{% include schema_org.html %}
{{ content }}
{% include syllabus.html %}

0 comments on commit a3ba5be

Please sign in to comment.