feat: drop ENABLE_MKTG_SITE flag and MKTG_URL_LINK_MAP setting#38720
Draft
feanil wants to merge 19 commits into
Draft
feat: drop ENABLE_MKTG_SITE flag and MKTG_URL_LINK_MAP setting#38720feanil wants to merge 19 commits into
feanil wants to merge 19 commits into
Conversation
…lution ENABLE_MKTG_SITE was a feature flag that selected between two URL resolution strategies: MKTG_URLS (external marketing site) vs MKTG_URL_LINK_MAP (local Django URL reversal). The local-template path is now legacy; all operators are expected to use MKTG_URLS. This commit removes the flag and its conditional branches, keeping the MKTG_URLS-based behaviour unconditionally: - Drop the setting definition and toggle annotation from openedx/envs/common.py - Remove the override from lms/envs/devstack.py and both mock.yml files - Simplify marketing_link() and is_marketing_link_set() in edxmako/shortcuts.py to always consult MKTG_URLS; drop the MKTG_URL_LINK_MAP fallback branches and the now-unused NoReverseMatch/reverse/set_custom_attribute/get_current_request_hostname imports - Update validate_marketing_site_setting() in checks.py to always validate MKTG_URLS rather than gating validation on ENABLE_MKTG_SITE - Trim edxmako/tests.py: remove False-path test variants and the MKTG_URL_LINK_MAP link-reversal test; each remaining test now exercises a single, unconditional code path Part of #37053 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
index() (served at /) now unconditionally checks MKTG_URLS['ROOT'] and redirects
when it differs from LMS_ROOT_URL, matching the previous ENABLE_MKTG_SITE=True
behaviour. The catalog MFE redirect (ENABLE_CATALOG_MICROFRONTEND) still fires
first and is unaffected.
courses() (served at /courses) now always permanently redirects to
marketing_link('COURSES') from MKTG_URLS. The COURSES_ARE_BROWSABLE fallback
to the LMS courseware course-list view is removed, as is the now-unused
courseware_views import.
Tests drop their @override_settings(ENABLE_MKTG_SITE=True) decorators;
the test names and assertions are otherwise unchanged.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… API
- course_about_url in enrollment emails now uses
get_link_for_about_page(), resolving the marketing URL, social sharing
URL, or LMS about URL as a fallback
- get_link_for_about_page() uses course.marketing_url unconditionally
- has_marketing_url() returns bool(self.marketing_url) directly
- url_to_enroll() always returns marketing_link('COURSES')
- _course_home_redirect_enabled() only checks ENABLE_COURSE_HOME_REDIRECT
- Remove ENABLE_MKTG_SITE patches from courseware, instructor, and
mobile API tests; merge redundant test cases where applicable
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Email change confirmation contact link now always comes from
marketing_link('CONTACT') via MKTG_URLS. Remove the fallback that
constructed a local URL when the flag was False.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- contentstore utils: marketing_enabled is always True - registration tests: remove ENABLE_MKTG_SITE=False test cases that tested now-dead local URL generation for honor code and TOS links; remove ENABLE_MKTG_SITE=True decorators from the remaining tests - site_configuration test mixin: remove ENABLE_MKTG_SITE example key - schedules README: remove ENABLE_MKTG_SITE from example config Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Marketing navigation links (HOW_IT_WORKS, COURSES, SCHOOLS) are now always rendered in the unauthenticated nav bars. marketing_link() falls back to '#' when a URL is not configured in MKTG_URLS. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This setting was the fallback URL resolution mechanism used when ENABLE_MKTG_SITE=False. Now that the flag is gone, only MKTG_URLS is used for marketing link resolution. - Remove MKTG_URL_LINK_MAP definition from openedx/envs/common.py - Remove LMS-specific update block from lms/envs/common.py - Remove test environment override from lms/envs/test.py - Remove YAML loading and dict-update from lms and cms production envs - Remove the dynamic URL registration loop from static_template_view - Remove MKTG_URL_LINK_MAP.keys() union from the marketing link context processor in edxmako/shortcuts.py Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove the 14 template files that were served locally when ENABLE_MKTG_SITE=False. These pages (about, blog, contact, donate, faq, help, honor, jobs, media-kit, news, press, privacy, tos, sitemap.xml) should now only live on the external marketing site configured via MKTG_URLS. Also remove the stanford-style theme overrides for about.html and tos.html, the hardcoded URL patterns for the deleted templates, the honor.html iframing special case from the render view, and the tests that exercised these now-deleted routes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
022fef1 to
28e34b7
Compare
feanil
commented
Jun 5, 2026
| Verify the correct about URL base is used when neither social sharing URL nor | ||
| marketing URL is set (catalog MFE URL vs LMS root URL). | ||
| """ | ||
| self.course_overview.marketing_url = None |
Contributor
Author
There was a problem hiding this comment.
Note for reviewer:
setUp always sets marketing_url = 'test_marketing_url'. Previously, an ENABLE_MKTG_SITE gate in
get_link_for_about_page prevented that value from being used, so the test happened to reach the
fallback path anyway. After removing the gate, marketing_url is checked unconditionally, so the test
has to explicitly clear it to force the function into the fallback path it's actually testing.
The E003 check required MKTG_URLS['ROOT'] to be defined, but this key
is optional. The index() view in branding/views.py already handles the
case where ROOT is absent:
root_url = marketing_urls.get("ROOT")
if root_url and root_url != getattr(settings, "LMS_ROOT_URL", None):
return redirect(root_url)
Previously, E003 was only triggered when ENABLE_MKTG_SITE=True (the
check was guarded by that flag). After removing ENABLE_MKTG_SITE in
#38720, the check runs
unconditionally and fires in any environment where MKTG_URLS has no
ROOT key (including test and CMS environments). Since ROOT is genuinely
optional, the check is incorrect and should not be enforced.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The /courses URL routes to branding.views.courses(), which previously
delegated to courseware.views.views.courses() when ENABLE_MKTG_SITE=False.
That delegation was removed in the ENABLE_MKTG_SITE cleanup — branding.views.courses()
now always redirects to the catalog MFE, marketing COURSES URL, or the site
root. With no delegation and no URL route of its own, courseware.views.views.courses()
and its courseware/courses.html template are completely unreachable.
Remove:
- courseware.views.views.courses() and its now-orphaned imports
(get_courses, sort_by_announcement, sort_by_start_date, get_programs_with_type,
ENABLE_COURSE_DISCOVERY_DEFAULT_LANGUAGE_FILTER)
- lms/templates/courseware/courses.html
- common/test/test-theme/lms/templates/courseware/courses.html (theme override)
Update:
- branding/views.py: update courses() docstring; fix log.error() call in index()
that was passing multiple f-strings as positional args (triggers TypeError
when the except NoReverseMatch branch is reached)
- stanford-style footer.html: replace reverse('about') and reverse('tos') with
marketing_link('ABOUT') and marketing_link('TOS') — those URL routes were
removed in the static template cleanup
Remove tests that exercised the dead rendering path:
- test_theme_style_overrides.py: test_include_{default,overridden,custom}_template
- test_page.py: /courses assertions in test_course_discovery_{off,on} and
test_course_cards_sorted_by_{default_sorting,start_date_disabled};
test_invisible_courses_are_not_displayed; /courses entry in
test_get_programs_with_type_called
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #37053.
This PR removes the
ENABLE_MKTG_SITEfeature flag by retaining all code as if the flag were alwaysTrue(i.e., always use the external marketing site viaMKTG_URLS). It also removes the companionMKTG_URL_LINK_MAPsetting and deletes the legacy static marketing templates that were served locally whenENABLE_MKTG_SITE=False.Changes by commit
Remove
ENABLE_MKTG_SITEsetting and simplify marketing URL resolution — Core helpermarketing_link()now only reads fromMKTG_URLS; removesMKTG_URL_LINK_MAPfallback path; always validatesMKTG_URLSin the startup check; simplifies tests.Remove
ENABLE_MKTG_SITEfrom LMS branding views —index()andcourses()no longer gate their redirects on the flag.Remove
ENABLE_MKTG_SITEfrom enrollment, courseware, and mobile API —course_about_urlin enrollment emails is alwaysNone;get_link_for_about_page()usescourse.marketing_urlunconditionally;has_marketing_url()simplified; test patches removed.Remove
ENABLE_MKTG_SITEfrom student email view — Email change confirmation contact link always comes frommarketing_link('CONTACT').Remove
ENABLE_MKTG_SITEfrom CMS, registration tests, and docs —marketing_enabledin contentstore is alwaysTrue; legacy ENABLE_MKTG_SITE=False registration test cases deleted.Remove
ENABLE_MKTG_SITEguards from navbar templates — Marketing nav links always rendered in unauthenticated navbars.Remove
MKTG_URL_LINK_MAPsetting — Removes the setting definition from all env files, removes the dynamic URL registration loop fromstatic_template_view, and removes the union withMKTG_URL_LINK_MAP.keys()in the marketing link context processor.Delete legacy marketing static templates and their URL routes — Removes 14+2 template files (about, blog, contact, donate, faq, help, honor, jobs, media-kit, news, press, privacy, tos, sitemap.xml) and their hardcoded URL patterns.
What is NOT changed
embargo.htmland therender_403/404/429/500error handlers are keptMKTG_URLSandMKTG_URL_OVERRIDESsettings are kept (the replacement mechanism)press_releaseURL pattern (servespress_releases/directory) is keptsite_configurationtest infrastructure files that useENABLE_MKTG_SITEas an example key for testing the generic get_value/has_override_value mechanismMFE impact and follow-up work
The CMS course settings API (
GET /api/contentstore/v1/course_settings/{course_id}) includes amarketing_enabledfield that was previously read fromENABLE_MKTG_SITE. It now always returnsTrue.This field controls a conditional in
frontend-app-authoring's Schedule & Details page (src/schedule-and-details/basic-section/index.jsx):marketing_enabled: false(old legacy path): Shows a "Course summary page" card with a direct link to the LMS about page and an "Invite your students" mailto button — designed for operators self-hosting course pages locally.marketing_enabled: true(now always): Shows a dismissible "Promoting your course with {platformName}" banner explaining that the course summary page requires announcement before it's viewable.Operators who had
ENABLE_MKTG_SITE=Falsewill now see the banner instead of the enrollment card. Since those operators were relying on the local static templates this PR removes, this is an expected consequence of the migration.Follow-up PR in
frontend-app-authoring: Remove themarketingEnabledconditional entirely (always render the banner as the default), and extract the currentfalse-path enrollment card into a named exported component that operators can drop into the adjacentPageBannerSlotif they want to preserve that UX.