Skip to content

Commit ecd22b5

Browse files
committed
[Rules] Snippets maintenance template to use 503 by default
1 parent 346ee31 commit ecd22b5

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/content/docs/rules/snippets/examples/maintenance.mdx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ description: Serve a custom maintenance page instead of fetching content from th
1414

1515
```js
1616
// Define your customizable inputs
17+
const statusCode = 503;
1718
const title = "We'll Be Right Back!";
1819
const message = "Our site is currently undergoing scheduled maintenance. We’re working hard to bring you a better experience. Thank you for your patience and understanding.";
1920
const estimatedTime = "1 hour";
@@ -24,7 +25,11 @@ export default {
2425
async fetch(request) {
2526
// Serve the maintenance page as a response
2627
return new Response(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+
},
2833
});
2934
},
3035
};
@@ -91,7 +96,7 @@ function generateMaintenancePage() {
9196
<p>${message}</p>
9297
<p>If all goes to plan, we'll be back online in <span class="timer">${estimatedTime}</span>. 🚀</p>
9398
<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>
95100
or call us at <a href="tel:${contactPhone}">${contactPhone}</a>.
96101
</p>
97102
</div>

0 commit comments

Comments
 (0)