link_to_external_resource: Converts markdown links present in the content body and metadata into external resources and resource_link shortcodes.
nav_item_external_resource: Converts external menu links to external resources and updates menu accordingly.
Additionally, this PR introduces a new method on the MarkdownCleanupRule class. set_options allows a client to set dynamic options for a rule. This was introduced so that we could forward options like commit down to the rule's implementation.
docker compose exec web ./manage.py markdown_cleanup link_to_external_resource --skip-sync --out link_to_external_resource.csv
docker compose exec web ./manage.py markdown_cleanup nav_item_to_external_resource --skip-sync --out nav_item_to_external_resource.csv
Analyze the output files.
Expect changes to be predictable and valid.
Choose specific courses to apply the changes to and test builds with. For example, this test course.
Run the following set of commands for specific courses. These will run a rule for a specific course, reset the courses sync states, populate the course's pipelines, and sync the course markdown to the backend. So please make sure your GitHub backend is set up.
COURSE_ID=<course-id>
docker compose exec web ./manage.py markdown_cleanup <rule> --skip-sync --commit --filter $COURSE_ID
docker compose exec web ./manage.py reset_sync_states --skip_sync --filter $COURSE_ID && docker compose exec web ./manage.py backpopulate_pipelines --filter $COURSE_ID && docker compose exec web ./manage.py sync_website_to_backend --filter $COURSE_ID --delete
Publish your changes from the Studio UI.
Expect the build to succeed.
Expect the external resources to be functioning properly i.e. they open external links, have the correct icon, and open a warning modal if applicable.
What are the relevant tickets?
Closes https://github.com/mitodl/hq/issues/3678
Description (What does it do?)
This PR creates two new markdown cleanup rules.
link_to_external_resource
: Converts markdown links present in the content body and metadata into external resources andresource_link
shortcodes.nav_item_external_resource
: Converts external menu links to external resources and updates menu accordingly.Additionally, this PR introduces a new method on the
MarkdownCleanupRule
class.set_options
allows a client to set dynamic options for a rule. This was introduced so that we could forward options likecommit
down to the rule's implementation.Example outputs:
How can this be tested?
Prerequisites
Steps
ocw-studio
setup.hussaintaj/3678-migrate-link-2-external-resource
.