diff --git a/school/www/cohorts/cohort.html b/school/www/cohorts/cohort.html
index edfa2434..78d90ba1 100644
--- a/school/www/cohorts/cohort.html
+++ b/school/www/cohorts/cohort.html
@@ -32,7 +32,7 @@
{% if not page %}
{{ render_subgroups() }}
{% else %}
- {{ cohort.get_page_template(page) }}
+ {{ render_page(page) }}
{% endif %}
diff --git a/school/www/cohorts/cohort.py b/school/www/cohorts/cohort.py
index dae645f3..e8db20fa 100644
--- a/school/www/cohorts/cohort.py
+++ b/school/www/cohorts/cohort.py
@@ -31,3 +31,8 @@ def get_context(context):
context.is_mentor = is_mentor
context.is_admin = is_admin
context.page = frappe.form_dict.get("page") or ""
+
+ # Function to render to custom page given the slug
+ context.render_page = lambda page: frappe.render_template(
+ cohort.get_page_template(page),
+ context)