Skip to content

Commit 7f69b4d

Browse files
committed
Refactor Slack redirect logic to use centralized URL variable
Signed-off-by: Pete Cheslock <[email protected]>
1 parent f2a961c commit 7f69b4d

File tree

1 file changed

+39
-17
lines changed

1 file changed

+39
-17
lines changed

static/slack/index.html

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,36 @@
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66

7-
<!-- Primary redirect method - HTTP meta refresh (works in virtually all browsers) -->
8-
<meta http-equiv="refresh" content="2; url=https://communityinviter.com/apps/llm-d/join-the-llm-d-community">
9-
10-
<!-- Alternative refresh method for maximum compatibility -->
11-
<meta http-equiv="location" content="https://communityinviter.com/apps/llm-d/join-the-llm-d-community">
12-
13-
<!-- Canonical URL for SEO and indicating the destination -->
14-
<link rel="canonical" href="https://communityinviter.com/apps/llm-d/join-the-llm-d-community">
7+
<!-- Centralized URL configuration -->
8+
<script>
9+
// Define the Slack invite URL in ONE place for easy updates
10+
var SLACK_INVITE_URL = 'https://inviter.co/llm-d-slack';
11+
12+
// Immediately write critical meta tags using the variable
13+
// This works because document.write executes during HTML parsing
14+
document.write('<meta http-equiv="refresh" content="2; url=' + SLACK_INVITE_URL + '">');
15+
document.write('<meta http-equiv="location" content="' + SLACK_INVITE_URL + '">');
16+
document.write('<link rel="canonical" href="' + SLACK_INVITE_URL + '">');
17+
document.write('<meta property="og:url" content="' + SLACK_INVITE_URL + '">');
18+
19+
// Store in window object for later use
20+
window.SLACK_INVITE_URL = SLACK_INVITE_URL;
21+
22+
// Update user-facing elements that can be dynamically populated
23+
document.addEventListener('DOMContentLoaded', function() {
24+
// Update fallback link
25+
const fallbackLink = document.getElementById('fallback-link');
26+
if (fallbackLink) {
27+
fallbackLink.setAttribute('href', window.SLACK_INVITE_URL);
28+
}
29+
30+
// Update manual URL text
31+
const manualUrl = document.getElementById('manual-url');
32+
if (manualUrl) {
33+
manualUrl.textContent = window.SLACK_INVITE_URL;
34+
}
35+
});
36+
</script>
1537

1638
<!-- Page title and meta information -->
1739
<title>Redirecting to llm-d Slack Community</title>
@@ -21,7 +43,6 @@
2143
<!-- Open Graph tags for social sharing -->
2244
<meta property="og:title" content="Join llm-d Slack Community">
2345
<meta property="og:description" content="Join the llm-d community on Slack">
24-
<meta property="og:url" content="https://communityinviter.com/apps/llm-d/join-the-llm-d-community">
2546
<meta property="og:type" content="website">
2647

2748
<!-- Twitter Card tags -->
@@ -114,16 +135,16 @@ <h1>Join the llm-d Slack Community</h1>
114135

115136
<!-- Primary fallback link for users who disable auto-redirects -->
116137
<p>
117-
<a href="https://communityinviter.com/apps/llm-d/join-the-llm-d-community" class="redirect-link">
138+
<a href="#" id="fallback-link" class="redirect-link">
118139
Click here if you are not redirected automatically
119140
</a>
120141
</p>
121142

122143
<div class="manual-instructions">
123144
<p><strong>If the redirect doesn't work:</strong></p>
124145
<p>Please copy and paste this URL into your browser:</p>
125-
<p style="word-break: break-all; font-family: monospace; background: #f8f9fa; padding: 10px; border-radius: 4px;">
126-
https://communityinviter.com/apps/llm-d/join-the-llm-d-community
146+
<p id="manual-url" style="word-break: break-all; font-family: monospace; background: #f8f9fa; padding: 10px; border-radius: 4px;">
147+
<!-- URL will be populated by JavaScript -->
127148
</p>
128149
</div>
129150
</div>
@@ -145,21 +166,22 @@ <h1>Join the llm-d Slack Community</h1>
145166
clearInterval(countdown);
146167
// JavaScript redirect as final fallback
147168
setTimeout(function() {
148-
window.location.replace("https://communityinviter.com/apps/llm-d/join-the-llm-d-community");
169+
window.location.replace(window.SLACK_INVITE_URL);
149170
}, 100);
150171
}
151172
}, 1000);
152173
} else {
153174
// Fallback if elements not found - immediate redirect
154175
setTimeout(function() {
155-
window.location.replace("https://communityinviter.com/apps/llm-d/join-the-llm-d-community");
176+
window.location.replace(window.SLACK_INVITE_URL);
156177
}, 2000);
157178
}
158179
</script>
159180

160181
<!-- Noscript fallback for browsers with JavaScript disabled -->
161-
<noscript>
162-
<meta http-equiv="refresh" content="2; url=https://communityinviter.com/apps/llm-d/join-the-llm-d-community">
163-
</noscript>
182+
<script>
183+
// Write the noscript fallback using the variable
184+
document.write('<noscript><meta http-equiv="refresh" content="2; url=' + SLACK_INVITE_URL + '"></noscript>');
185+
</script>
164186
</body>
165187
</html>

0 commit comments

Comments
 (0)