Skip to content

Commit

Permalink
Certificate: using product title (#2024)
Browse files Browse the repository at this point in the history
  • Loading branch information
annagav authored Dec 13, 2023
1 parent c9e0a03 commit c7e299b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
6 changes: 5 additions & 1 deletion cms/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,13 @@ def get_context(self, request, *args, **kwargs):
is_program_certificate = False
if isinstance(self.certificate, ProgramCertificate):
is_program_certificate = True
product_name = self.parent.program.title
else:
product_name = self.parent.course.title

context = {
"uuid": self.certificate.uuid,
"product_name": product_name,
"certificate_user": self.certificate.user,
"learner_name": self.certificate.user.get_full_name(),
"start_date": start_date,
Expand All @@ -458,7 +462,7 @@ def get_context(self, request, *args, **kwargs):
"share_image_width": "1665",
"share_image_height": "1291",
"share_text": "I just earned a certificate in {} from {}".format(
self.product_name, settings.SITE_NAME
product_name, settings.SITE_NAME
),
**super().get_context(request, *args, **kwargs),
**preview_context,
Expand Down
12 changes: 6 additions & 6 deletions cms/templates/certificate_page.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{% extends "base.html" %}
{% load static wagtailimages_tags %}

{% block title %}{{ site_name }} | Certificate for: {{ page.product_name }}{% endblock %}
{% block title %}{{ site_name }} | Certificate for: {{ product_name }}{% endblock %}

{% block seohead %}
{{ block.super }}
<meta property="og:site_name" content="{{ site_name }}" />
<meta property="og:type" content="website" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@MITxonedX" />
<meta property="og:title" content="{{ site_name }} | Certificate for: {{ page.product_name }}" />
<meta property="og:description" content="Certificate for {{ page.product_name }} awarded by {{ site_name }}." />
<meta property="og:title" content="{{ site_name }} | Certificate for: {{ product_name }}" />
<meta property="og:description" content="Certificate for {{ product_name }} awarded by {{ site_name }}." />
<meta property="og:url" content="{{ request.build_absolute_uri }}" />
<meta property="og:image:width" content="{{ share_image_width }}" />
<meta property="og:image:height" content="{{ share_image_height }}" />
Expand All @@ -36,7 +36,7 @@
</a>
</li>
<li>
<a href="https://www.linkedin.com/profile/add?startTask={{ page.product_name|urlencode }}" target="_blank">
<a href="https://www.linkedin.com/profile/add?startTask={{ product_name|urlencode }}" target="_blank">
<img src="{% static 'images/certificates/icon-linkedin.svg' %}" alt="Share to LinkedIn">
</a>
</li>
Expand All @@ -47,7 +47,7 @@
</li>
</ul>
<h2>Congratulations, {{ learner_name }}!</h2>
<p>You have successfully completed {{ page.product_name }}. Share your accomplishment with your friends, family and colleagues. </p>
<p>You have successfully completed {{ product_name }}. Share your accomplishment with your friends, family and colleagues. </p>
</div>
</div>
</div>
Expand All @@ -67,7 +67,7 @@ <h2>Congratulations, {{ learner_name }}!</h2>
<span class="certify-text">This is to certify that</span>
<span class="certify-name">{{ learner_name }}</span>
<span class="success-text">has successfully completed {% if is_program_certificate %}all courses and received passing grades to earn a MicroMasters program certificate in{% endif %}</span>
<span class="degree-text">{{ page.product_name }}</span>
<span class="degree-text">{{ product_name }}</span>
{% if is_program_certificate %}
<span class="success-text">a program of study offered by MITx, an online learning initiative of the Massachusetts Institute of Technology<br></span>
{% endif %}
Expand Down

0 comments on commit c7e299b

Please sign in to comment.