mitodl / ocw-hugo-themes

A Hugo theme for building OCW websites
BSD 3-Clause "New" or "Revised" License
5 stars 4 forks source link

standardize resource_link shortcode's output #1376

Open HussainTaj-arbisoft opened 7 months ago

HussainTaj-arbisoft commented 7 months ago

Description/Context

At the time of this writing, our resource_link shortcode can produce two types of output.

Studio uses this shortcode with {{% tags i.e {{% resource_link ... %}}. {{% syntax processes markdown content while the alternative {{< syntax does not.

The shortcode should return one kind of output so that the use of the shortcode follows a consistent syntax. Mixing the output types has the potential to cause unexpected rendering problems.

For information on the issues we have faced, you may read https://github.com/mitodl/ocw-hugo-themes/pull/1371#discussion_r1537439236. And for more details about the issue itself, you may read this excellent explanation by @gumaerc.

Plan/Design

The approach we follow relies on the future of External Resources. If their UI flow changes, we might not need to change resource_link. We can use the shortcode external_resource_link instead. However, if the UI flow remains the same, we will need to update the resource_link shortcode to return only HTML and update all of its usage.

(Originally proposed in https://github.com/mitodl/ocw-hugo-themes/pull/1371#discussion_r1538184588)

The latter will require the following steps:

  1. Update resource_link to return only HTML.
  2. Update Studio's CKEditor to support {{< resource_link ... >}} syntax.
  3. Update the usage inside existing content and publish the updates.