summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--packages/astro/src/core/ssr/sitemap.ts43
-rw-r--r--packages/astro/src/vite-plugin-build-html/index.ts45
2 files changed, 85 insertions, 3 deletions
diff --git a/packages/astro/src/core/ssr/sitemap.ts b/packages/astro/src/core/ssr/sitemap.ts
index d641113f8..c4f85b556 100644
--- a/packages/astro/src/core/ssr/sitemap.ts
+++ b/packages/astro/src/core/ssr/sitemap.ts
@@ -1,4 +1,45 @@
-const ERROR_STATUS_CODE_REGEXES = [ /400\/?$/,/401\/?$/,/402\/?$/,/403\/?$/,/404\/?$/,/405\/?$/,/406\/?$/,/407\/?$/,/408\/?$/,/409\/?$/,/410\/?$/,/411\/?$/,/412\/?$/,/413\/?$/,/414\/?$/,/415\/?$/,/416\/?$/,/417\/?$/,/418\/?$/,/421\/?$/,/422\/?$/,/423\/?$/,/424\/?$/,/425\/?$/,/426\/?$/,/428\/?$/,/429\/?$/,/431\/?$/,/451\/?$/,/500\/?$/,/501\/?$/,/502\/?$/,/503\/?$/,/504\/?$/,/505\/?$/,/506\/?$/,/507\/?$/,/508\/?$/,/510\/?$/,/511\/?$/ ];
+const ERROR_STATUS_CODE_REGEXES = [
+ /400\/?$/,
+ /401\/?$/,
+ /402\/?$/,
+ /403\/?$/,
+ /404\/?$/,
+ /405\/?$/,
+ /406\/?$/,
+ /407\/?$/,
+ /408\/?$/,
+ /409\/?$/,
+ /410\/?$/,
+ /411\/?$/,
+ /412\/?$/,
+ /413\/?$/,
+ /414\/?$/,
+ /415\/?$/,
+ /416\/?$/,
+ /417\/?$/,
+ /418\/?$/,
+ /421\/?$/,
+ /422\/?$/,
+ /423\/?$/,
+ /424\/?$/,
+ /425\/?$/,
+ /426\/?$/,
+ /428\/?$/,
+ /429\/?$/,
+ /431\/?$/,
+ /451\/?$/,
+ /500\/?$/,
+ /501\/?$/,
+ /502\/?$/,
+ /503\/?$/,
+ /504\/?$/,
+ /505\/?$/,
+ /506\/?$/,
+ /507\/?$/,
+ /508\/?$/,
+ /510\/?$/,
+ /511\/?$/,
+];
/** Construct sitemap.xml given a set of URLs */
export function generateSitemap(pages: string[]): string {
diff --git a/packages/astro/src/vite-plugin-build-html/index.ts b/packages/astro/src/vite-plugin-build-html/index.ts
index 8c4016658..33b4ab70f 100644
--- a/packages/astro/src/vite-plugin-build-html/index.ts
+++ b/packages/astro/src/vite-plugin-build-html/index.ts
@@ -25,7 +25,48 @@ const ASTRO_PAGE_PREFIX = '@astro-page';
const ASTRO_SCRIPT_PREFIX = '@astro-script';
const ASTRO_EMPTY = '@astro-empty';
-const ERROR_STATUS_CODES = [ '400', '401', '402', '403', '404', '405', '406', '407', '408', '409', '410', '411', '412', '413', '414', '415', '416', '417', '418', '421', '422', '423', '424', '425', '426', '428', '429', '431', '451', '500', '501', '502', '503', '504', '505', '506', '507', '508', '510', '511' ];
+const ERROR_STATUS_CODES = [
+ '400',
+ '401',
+ '402',
+ '403',
+ '404',
+ '405',
+ '406',
+ '407',
+ '408',
+ '409',
+ '410',
+ '411',
+ '412',
+ '413',
+ '414',
+ '415',
+ '416',
+ '417',
+ '418',
+ '421',
+ '422',
+ '423',
+ '424',
+ '425',
+ '426',
+ '428',
+ '429',
+ '431',
+ '451',
+ '500',
+ '501',
+ '502',
+ '503',
+ '504',
+ '505',
+ '506',
+ '507',
+ '508',
+ '510',
+ '511',
+];
interface PluginOptions {
astroConfig: AstroConfig;
@@ -483,7 +524,7 @@ export function rollupPluginAstroBuildHTML(options: PluginOptions): VitePlugin {
// Output directly to 404.html rather than 404/index.html
// Supports any other status codes, too
- if (ERROR_STATUS_CODES.find(code => code === name) || astroConfig.buildOptions.pageUrlFormat === 'file') {
+ if (ERROR_STATUS_CODES.find((code) => code === name) || astroConfig.buildOptions.pageUrlFormat === 'file') {
outPath = `${removeEndingForwardSlash(name || 'index')}.html`;
} else {
outPath = npath.posix.join(name, 'index.html');