Skip to content

feat: drop ENABLE_MKTG_SITE flag and MKTG_URL_LINK_MAP setting#38720

Draft
feanil wants to merge 19 commits into
masterfrom
feanil/depr_legacy_static
Draft

feat: drop ENABLE_MKTG_SITE flag and MKTG_URL_LINK_MAP setting#38720
feanil wants to merge 19 commits into
masterfrom
feanil/depr_legacy_static

Conversation

@feanil

@feanil feanil commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #37053.

This PR removes the ENABLE_MKTG_SITE feature flag by retaining all code as if the flag were always True (i.e., always use the external marketing site via MKTG_URLS). It also removes the companion MKTG_URL_LINK_MAP setting and deletes the legacy static marketing templates that were served locally when ENABLE_MKTG_SITE=False.

Changes by commit

  1. Remove ENABLE_MKTG_SITE setting and simplify marketing URL resolution — Core helper marketing_link() now only reads from MKTG_URLS; removes MKTG_URL_LINK_MAP fallback path; always validates MKTG_URLS in the startup check; simplifies tests.

  2. Remove ENABLE_MKTG_SITE from LMS branding viewsindex() and courses() no longer gate their redirects on the flag.

  3. Remove ENABLE_MKTG_SITE from enrollment, courseware, and mobile APIcourse_about_url in enrollment emails is always None; get_link_for_about_page() uses course.marketing_url unconditionally; has_marketing_url() simplified; test patches removed.

  4. Remove ENABLE_MKTG_SITE from student email view — Email change confirmation contact link always comes from marketing_link('CONTACT').

  5. Remove ENABLE_MKTG_SITE from CMS, registration tests, and docsmarketing_enabled in contentstore is always True; legacy ENABLE_MKTG_SITE=False registration test cases deleted.

  6. Remove ENABLE_MKTG_SITE guards from navbar templates — Marketing nav links always rendered in unauthenticated navbars.

  7. Remove MKTG_URL_LINK_MAP setting — Removes the setting definition from all env files, removes the dynamic URL registration loop from static_template_view, and removes the union with MKTG_URL_LINK_MAP.keys() in the marketing link context processor.

  8. 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

  • Error templates (404, 429, server-down, server-error, server-overloaded) are kept
  • embargo.html and the render_403/404/429/500 error handlers are kept
  • MKTG_URLS and MKTG_URL_OVERRIDES settings are kept (the replacement mechanism)
  • The press_release URL pattern (serves press_releases/ directory) is kept
  • site_configuration test infrastructure files that use ENABLE_MKTG_SITE as an example key for testing the generic get_value/has_override_value mechanism

MFE impact and follow-up work

The CMS course settings API (GET /api/contentstore/v1/course_settings/{course_id}) includes a marketing_enabled field that was previously read from ENABLE_MKTG_SITE. It now always returns True.

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=False will 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 the marketingEnabled conditional entirely (always render the banner as the default), and extract the current false-path enrollment card into a named exported component that operators can drop into the adjacent PageBannerSlot if they want to preserve that UX.

feanil and others added 8 commits June 5, 2026 10:58
…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>
@feanil feanil force-pushed the feanil/depr_legacy_static branch from 022fef1 to 28e34b7 Compare June 5, 2026 15:01
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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

feanil and others added 7 commits June 5, 2026 15:46
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DEPR]: Drop ENABLE_MKTG_SITE flag and legacy static templates

1 participant