You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/rules/snippets/examples/maintenance.mdx
+7-2Lines changed: 7 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,7 @@ description: Serve a custom maintenance page instead of fetching content from th
14
14
15
15
```js
16
16
// Define your customizable inputs
17
+
conststatusCode=503;
17
18
consttitle="We'll Be Right Back!";
18
19
constmessage="Our site is currently undergoing scheduled maintenance. We’re working hard to bring you a better experience. Thank you for your patience and understanding.";
19
20
constestimatedTime="1 hour";
@@ -24,7 +25,11 @@ export default {
24
25
asyncfetch(request) {
25
26
// Serve the maintenance page as a response
26
27
returnnewResponse(generateMaintenancePage(), {
27
-
headers: { "Content-Type":"text/html" },
28
+
status: statusCode,
29
+
headers: {
30
+
"Content-Type":"text/html",
31
+
"Retry-After":"3600", // Suggest retry after 1 hour
32
+
},
28
33
});
29
34
},
30
35
};
@@ -91,7 +96,7 @@ function generateMaintenancePage() {
91
96
<p>${message}</p>
92
97
<p>If all goes to plan, we'll be back online in <span class="timer">${estimatedTime}</span>. 🚀</p>
93
98
<p class="contact">
94
-
Need help? Reach out to us at <a href="mailto:${contactEmail}">${contactEmail}</a>
99
+
Need help? Reach out to us at <a href="mailto:${contactEmail}">${contactEmail}</a>
95
100
or call us at <a href="tel:${contactPhone}">${contactPhone}</a>.
0 commit comments