How to specify static_template page_content in custom plugin

Hi everyone,
I’m running tutor 14.0.2 with nutmeg. I’m writing to inquire if there is a way to add or modify the site_configuration settings via a custom plugin so that I can specify the page_content variables in the static_template mako files.

In this post (How to edit FAQ), there is mention of adding the static_template_[filename]_content to /admin/site_configuration/siteconfiguration/ on the lms. However, with my tutor installation, this directory structure does not exist.

The directory structure I have is:
tutor/data
tutor/env

Tutor plugins sit in a tutor_plugins directory at the same level as tutor/ and custom themes are located in tutor/env/build/openedx/themes/customtheme/

For simplicity, is it possible to specify the following in my custom plugin so that when the FAQ page loads, it reads this content into the page_content variable in that FAQ template:
{“static_template_faq_content”: “

example faq content

”}

Thank you for any insights you can provide.

I couldn’t figure out how to add the content to the site_configuration settings, but the other way to do this is in the custom theme directory, create the static page you want to add the content to and then add in the block names and content. So for the FAQ page:

  1. Create the faq.html file here: tutor/env/build/openedx/themes/customtheme/lms/templates/static_templates/

  2. Make the contents of the file as follows:

<%page expression_filter="h"/>
<%! from django.utils.translation import ugettext as _ %>
<%inherit file="faq.html" />

<%block name="pageheader">
    This is the page header
</%block>

<%block name="pagecontent">
    This is the page content
</%block>

The key is to inherit the static_templates file you want to inject the pageheader and pagecontent blocks into (in this case <%inherit file=“faq.html” />) and then just add those block content pieces to your custom file.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.