Skip to content

Commit ee4e2c1

Browse files
feanilclaude
andcommitted
feat: remove MKTG_URL_LINK_MAP setting
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>
1 parent a284587 commit ee4e2c1

10 files changed

Lines changed: 9 additions & 80 deletions

File tree

cms/envs/production.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ def get_env_setting(setting):
8484
'EVENT_TRACKING_BACKENDS',
8585
'JWT_AUTH',
8686
'CELERY_QUEUES',
87-
'MKTG_URL_LINK_MAP',
8887
'REST_FRAMEWORK',
8988
'EVENT_BUS_PRODUCER_CONFIG',
9089
'DEFAULT_FILE_STORAGE',
@@ -149,8 +148,6 @@ def get_env_setting(setting):
149148
CACHES['staticfiles']['KEY_PREFIX'] = EDX_PLATFORM_REVISION # noqa: F405
150149

151150

152-
MKTG_URL_LINK_MAP.update(_YAML_TOKENS.get('MKTG_URL_LINK_MAP', {})) # noqa: F405
153-
154151
#Timezone overrides
155152
TIME_ZONE = CELERY_TIMEZONE # noqa: F405
156153

common/djangoapps/edxmako/shortcuts.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
def marketing_link(name):
3333
"""Returns the URL for a marketing site link from MKTG_URLS.
3434
35-
MKTG_URL_OVERRIDES take priority. Falls back to '#' if the link is not configured.
35+
MKTG_URL_OVERRIDES take priority. 'ROOT' falls back to the local landing page
36+
('/'); any other unconfigured link falls back to '#'.
3637
"""
3738
marketing_urls = configuration_helpers.get_value(
3839
'MKTG_URLS',
@@ -69,6 +70,11 @@ def marketing_link(name):
6970
# e.g. urljoin('https://marketing.com', 'https://open-edx.org/about') >>> 'https://open-edx.org/about'
7071
return urljoin(marketing_urls.get('ROOT'), marketing_urls.get(name))
7172

73+
# ROOT is the live site root (not a legacy marketing page), so default it to
74+
# the local landing page when no marketing site ROOT is configured.
75+
if name == 'ROOT':
76+
return '/'
77+
7278
log.debug("Cannot find corresponding link for name: %s", name)
7379
return '#'
7480

@@ -108,9 +114,7 @@ def marketing_link_context_processor(request):
108114

109115
return {
110116
"MKTG_URL_" + k: marketing_link(k)
111-
for k in (
112-
settings.MKTG_URL_LINK_MAP.keys() | marketing_urls.keys()
113-
)
117+
for k in marketing_urls.keys()
114118
}
115119

116120

lms/djangoapps/static_template_view/urls.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"""
44

55

6-
from django.conf import settings
76
from django.urls import path, re_path
87

98
from lms.djangoapps.static_template_view import views
@@ -23,25 +22,3 @@
2322
# Press releases
2423
re_path(r'^press/([_a-zA-Z0-9-]+)$', views.render_press_release, name='press_release'),
2524
]
26-
27-
# Only enable URLs for those marketing links actually enabled in the
28-
# settings. Disable URLs by marking them as None.
29-
for key, value in settings.MKTG_URL_LINK_MAP.items():
30-
# Skip disabled URLs
31-
if value is None:
32-
continue
33-
34-
# These urls are enabled separately
35-
if key == "ROOT" or key == "COURSES": # pylint: disable=consider-using-in
36-
continue
37-
38-
# The MKTG_URL_LINK_MAP key specifies the template filename
39-
template = key.lower()
40-
if '.' not in template:
41-
# Append STATIC_TEMPLATE_VIEW_DEFAULT_FILE_EXTENSION if
42-
# no file extension was specified in the key
43-
template = f"{template}.{settings.STATIC_TEMPLATE_VIEW_DEFAULT_FILE_EXTENSION}"
44-
45-
# Make the assumption that the URL we want is the lowercased
46-
# version of the map key
47-
urlpatterns.append(re_path(r'^%s$' % key.lower(), views.render, {'template': template}, name=value)) # noqa: UP031

lms/envs/common.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2125,27 +2125,6 @@
21252125
'DEEP_LINKING': True,
21262126
}
21272127

2128-
######################### MARKETING SITE ###############################
2129-
2130-
MKTG_URL_LINK_MAP.update({ # noqa: F405
2131-
'ABOUT': 'about',
2132-
'CONTACT': 'contact',
2133-
'FAQ': 'help',
2134-
'COURSES': 'courses',
2135-
'ROOT': 'root',
2136-
'TOS': 'tos',
2137-
'HONOR': 'honor', # If your site does not have an honor code, simply delete this line.
2138-
'TOS_AND_HONOR': 'edx-terms-service',
2139-
'PRIVACY': 'privacy',
2140-
'PRESS': 'press',
2141-
'BLOG': 'blog',
2142-
'DONATE': 'donate',
2143-
'SITEMAP.XML': 'sitemap_xml',
2144-
2145-
# Verified Certificates
2146-
'WHAT_IS_VERIFIED_CERT': 'verified-certificate',
2147-
})
2148-
21492128
STATIC_TEMPLATE_VIEW_DEFAULT_FILE_EXTENSION = 'html'
21502129

21512130
SEND_ACTIVATION_EMAIL_URL = ''

lms/envs/minimal.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ TRACKING_BACKENDS: {}
1515
EVENT_TRACKING_BACKENDS: {}
1616
JWT_AUTH: {}
1717
CELERY_QUEUES: {}
18-
MKTG_URL_LINK_MAP: {}
1918
MKTG_URL_OVERRIDES: {}
2019
REST_FRAMEWORK: {}
2120

lms/envs/mock.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,6 @@ MKTG_URLS:
827827
TOS_AND_HONOR: hello
828828
TRADEMARKS: hello
829829
WHAT_IS_VERIFIED_CERT: hello
830-
MKTG_URL_LINK_MAP: {}
831830
MKTG_URL_OVERRIDES:
832831
course-v1:Org+Course+Run: hello
833832
MOBILE_STORE_URLS:

lms/envs/production.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ def get_env_setting(setting):
8080
'EVENT_TRACKING_BACKENDS',
8181
'JWT_AUTH',
8282
'CELERY_QUEUES',
83-
'MKTG_URL_LINK_MAP',
8483
'REST_FRAMEWORK',
8584
'EVENT_BUS_PRODUCER_CONFIG',
8685
'DEFAULT_FILE_STORAGE',
@@ -175,8 +174,6 @@ def get_env_setting(setting):
175174
}
176175
)
177176

178-
MKTG_URL_LINK_MAP.update(_YAML_TOKENS.get('MKTG_URL_LINK_MAP', {})) # noqa: F405
179-
180177
# Timezone overrides
181178
TIME_ZONE = CELERY_TIMEZONE # noqa: F405
182179

lms/envs/test.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -201,28 +201,6 @@
201201
ENABLE_MOBILE_REST_API = True
202202
ENABLE_VIDEO_ABSTRACTION_LAYER_API = True
203203

204-
######################### MARKETING SITE ###############################
205-
206-
MKTG_URL_LINK_MAP = {
207-
'ABOUT': 'about',
208-
'CONTACT': 'contact',
209-
'HELP_CENTER': 'help-center',
210-
'COURSES': 'courses',
211-
'ROOT': 'root',
212-
'TOS': 'tos',
213-
'HONOR': 'honor',
214-
'PRIVACY': 'privacy',
215-
'CAREERS': 'careers',
216-
'NEWS': 'news',
217-
'PRESS': 'press',
218-
'BLOG': 'blog',
219-
'DONATE': 'donate',
220-
'SITEMAP.XML': 'sitemap_xml',
221-
222-
# Verified Certificates
223-
'WHAT_IS_VERIFIED_CERT': 'verified-certificate',
224-
}
225-
226204
SUPPORT_SITE_LINK = 'https://example.support.edx.org'
227205
PASSWORD_RESET_SUPPORT_LINK = 'https://support.example.com/password-reset-help.html'
228206
ACTIVATION_EMAIL_SUPPORT_LINK = 'https://support.example.com/activation-email-help.html'

openedx/envs/common.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2131,7 +2131,6 @@ def add_optional_apps(optional_apps, installed_apps):
21312131

21322132
MKTG_URLS = {}
21332133
MKTG_URL_OVERRIDES = {}
2134-
MKTG_URL_LINK_MAP = {}
21352134

21362135
SUPPORT_SITE_LINK = ''
21372136

themes/stanford-style/lms/templates/register-sidebar.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ <h3>${_("Next Steps")}</h3>
2727
<p>${_("You will receive an activation email. You must click on the activation link to complete the process. Don't see the email? Check your spam folder and mark emails from class.stanford.edu as 'not spam', since you'll want to be able to receive email from your courses.")}</p>
2828
</div>
2929

30-
% if settings.MKTG_URL_LINK_MAP.get('FAQ'):
30+
% if is_marketing_link_set('FAQ'):
3131
<div class="cta cta-help">
3232
<h3>${_("Need Help?")}</h3>
3333
<p>${_("Need help in registering with {platform_name}?").format(platform_name=platform_name)}

0 commit comments

Comments
 (0)