The status of `url_name` for OLX html components

I have a set of courses I want to generate via OLX. For the moment at least (the POC), I just want to use html blocks with an iframe to show a set of html+javascript (slightly de-nastified Captivate exports). There are levels, lessons and units, and units have several captivate exports.

I tried

<course advanced_modules="[&quot;done&quot;]" course="1_1"
  display_name="Level 1, Lesson 1"
  enrollment_start="2014-03-01T04:00:00Z" org="ee" start="2014-03-03T00:00:00Z"
  url_name="Ongoing">
  <chapter display_name="Unit 1" url_name="unit_1">
    <sequential format="Learning Sequence" graded="true" display_name="Everyday English"
      url_name="1_1_everyday_english">
      <vertical display_name="Everyday English" url_name="1_1_everyday_english">
        <html display_name="Everyday English">
          <p>
            <iframe style="min-height: 500px;"
              src="https://local.openedx.io/public/ca/templates/index.html?mediaPath=/public/ca/media/&amp;dataPath=/public/ca/1/1/1/1_everyday_english/"
              width="100%" height="100%" scrolling="no" frameborder="0"></iframe>
          </p>
        </html>
        <done display_name="Everyday English Completion" url_name="1_1_everyday_english"
          align="right" />
      </vertical>
    </sequential>
    ...
  </chapter>
  <chapter display_name="Unit 2" url_name="unit_2">
...
        <html display_name="Everyday English">
          <p>
            <iframe style="min-height: 500px;"
              src="https://local.openedx.io/public/ca/templates/index.html?mediaPath=/public/ca/media/&amp;dataPath=/public/ca/1/1/2/1_everyday_english/"
              width="100%" height="100%" scrolling="no" frameborder="0"></iframe>
          </p>
        </html>
...

With the difference between the two sequential+vertical+html being the chapter, and then the dataPath that I pass to the URL in the iframe src. The problem is that unless I provide a url_name to the html, I get the second URL in BOTH the Unit 1 AND Unit 2 “Everyday English” htmls (and the so on for the subsequent sequential+vertical+htmls).

What is happening here? If I provide a (unique?) url_name, everything works as expected. Is it if I don’t provide a unique url_name then it makes a url_name from something else, and if that isn’t unique we somehow get an override?

HTML Components in OLX — Latest documentation wasn’t particularly clear about url_name… The “Element Attributes” section says display_name is obligatory, even though the Example of an HTML Component Embedded in a Vertical section doesn’t have one, and the attributes section doesn’t have url_name at all, even though it’s present in a few of the examples. My reading of example-of-separate-html-files was that I should only put url_name if I wanted to use a separate file, but putting the html content directly in the course.xml with the url_name attribute seemed to get me what I wanted.

Is the basic rule of thumb that basically everything in OLX needs a unique url_name? Or at least if I do put one I won’t go wrong? Any pointers most appreciated!

1 Like

Hi @AntonOfTheWoods I don’t know if these docs will answer your questions, but it’s the best we got on OLX. Feel free to make PRs to improve them! OLX — Latest documentation

There is no specification for OLX (yet) unfortunately, so the behavior of the system is all we can look to.

I would say based on my knowledge that yes, every container or component (vertical, html, problem, etc.) needs a unique ID, and if that isn’t found in either the url_name or the file name, it will be generated at import time. And if it’s generated at import time, I doubt there’s any guarantee that the generated ID is going to be stable or unique.

Is it if I don’t provide a unique url_name then it makes a url_name from something else, and if that isn’t unique we somehow get an override?

I’m not sure exactly what you mean by “override”, but I assume you mean that one HTML overwrites the other, and you get only one in the end, or the same one in two different places.

Here’s why:

It’s possible (“feature not a bug”) to have a single HTML component appear in multiple places in the course, and you can deliberately make this happen by giving the same url_name and referencing the same OLX file in multiple units. It sounds like you may be inadvertently making this happen by allowing auto-generated IDs (url_names) to be the same, causing one HTML to overwrite the other.

Is the basic rule of thumb that basically everything in OLX needs a unique url_name? Or at least if I do put one I won’t go wrong?

Yeah, I don’t think you’ll go wrong from giving things a url_name yourself, and I do think that everything should generally have a url_name.

1 Like