Skip to content

Commit

Permalink
🐛(rdfa) fix errors on Google Search Console
Browse files Browse the repository at this point in the history
Google Search Console requires more information for the RDFa information.
Fixed errors:
- Missing field 'hasCourseInstance'
- Either 'courseWorkload' or 'courseSchedule' should be specified
  (in 'hasCourseInstance')

fixes #2444
  • Loading branch information
igobranco committed Jun 27, 2024
1 parent ce11b21 commit 167c6ce
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Versioning](https://semver.org/spec/v2.0.0.html).

## [Unrealeased]

### Fixed

- Fix RDFa errors on Google Search Console

## [2.28.1]

### Fixed
Expand Down
31 changes: 15 additions & 16 deletions src/richie/apps/courses/templates/courses/cms/course_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -368,22 +368,21 @@ <h2 class="course-detail__title">{% blocktrans context "course_detail__title" %}
{% block runs %}
<div class="course-detail__aside">
{% render_model_add course "" "" "get_admin_url_to_add_run" %}
{% with runs_dict=current_page.course.course_runs_dict %}
{% with open_visible_runs=runs_dict.0|add:runs_dict.1|add:runs_dict.2|visible_on_course_page:request.toolbar.edit_mode_active %}
<!--
As course runs are rendered through React, we use meta tags to
setup course runs RFDa properties.
-->
{% for run in open_visible_runs %}
<span rel="hasCourseInstance" typeof="CourseInstance">
<meta property="name" content="{{ run.title }}" />
<meta property="inLanguage" content="{{ run.get_languages_display }}" />
<meta property="courseMode" content="online" />
<meta property="startDate" content="{{ run.start|date:'Y-m-d' }}" />
<meta property="endDate" content="{{ run.end|date:'Y-m-d' }}" />
</span>
{% endfor %}
{% endwith %}
{% with runs=current_page.course.course_runs|visible_on_course_page:request.toolbar.edit_mode_active %}
<!--
As course runs are rendered through React, we use meta tags to
setup course runs RFDa properties.
-->
{% for run in runs %}
<span rel="hasCourseInstance" typeof="CourseInstance">
<meta property="name" content='{{ run.title|default:current_page.get_title }}' />
<meta property="inLanguage" content="{{ run.get_languages_display }}" />
<meta property="courseMode" content="online" />
<meta property="startDate" content="{{ run.start|date:'Y-m-d' }}" />
<meta property="endDate" content="{{ run.end|date:'Y-m-d' }}" />
<meta property="courseWorkload" content="{{ current_page.course.pt_effort }}" />
</span>
{% endfor %}
{% endwith %}
</div>
{% endblock runs %}
Expand Down

0 comments on commit 167c6ce

Please sign in to comment.