diff options
author | 2025-06-05 14:25:23 +0000 | |
---|---|---|
committer | 2025-06-05 14:25:23 +0000 | |
commit | e586d7d704d475afe3373a1de6ae20d504f79d6d (patch) | |
tree | 7e3fa24807cebd48a86bd40f866d792181191ee9 /packages/integrations/sitemap/test/fixtures | |
download | astro-e586d7d704d475afe3373a1de6ae20d504f79d6d.tar.gz astro-e586d7d704d475afe3373a1de6ae20d504f79d6d.tar.zst astro-e586d7d704d475afe3373a1de6ae20d504f79d6d.zip |
Sync from a8e1c0a7402940e0fc5beef669522b315052df1blatest
Diffstat (limited to 'packages/integrations/sitemap/test/fixtures')
22 files changed, 216 insertions, 0 deletions
diff --git a/packages/integrations/sitemap/test/fixtures/dynamic/astro.config.mjs b/packages/integrations/sitemap/test/fixtures/dynamic/astro.config.mjs new file mode 100644 index 000000000..82d25b854 --- /dev/null +++ b/packages/integrations/sitemap/test/fixtures/dynamic/astro.config.mjs @@ -0,0 +1,7 @@ +import sitemap from '@astrojs/sitemap'; +import { defineConfig } from 'astro/config'; + +export default defineConfig({ + integrations: [sitemap()], + site: 'http://example.com' +}) diff --git a/packages/integrations/sitemap/test/fixtures/dynamic/package.json b/packages/integrations/sitemap/test/fixtures/dynamic/package.json new file mode 100644 index 000000000..1eac19a1b --- /dev/null +++ b/packages/integrations/sitemap/test/fixtures/dynamic/package.json @@ -0,0 +1,9 @@ +{ + "name": "@test/sitemap-dynamic", + "version": "0.0.0", + "private": true, + "dependencies": { + "astro": "workspace:*", + "@astrojs/sitemap": "workspace:*" + } +} diff --git a/packages/integrations/sitemap/test/fixtures/dynamic/src/pages/[...slug].astro b/packages/integrations/sitemap/test/fixtures/dynamic/src/pages/[...slug].astro new file mode 100644 index 000000000..9622cb374 --- /dev/null +++ b/packages/integrations/sitemap/test/fixtures/dynamic/src/pages/[...slug].astro @@ -0,0 +1,21 @@ +--- +export async function getStaticPaths() { + return [ + { + params: { + slug: undefined, + } + }, + { + params: { + slug: '/blog' + } + }, + { + params: { + slug: '/test' + } + } + ]; +} +--- diff --git a/packages/integrations/sitemap/test/fixtures/ssr/astro.config.mjs b/packages/integrations/sitemap/test/fixtures/ssr/astro.config.mjs new file mode 100644 index 000000000..ce84944bf --- /dev/null +++ b/packages/integrations/sitemap/test/fixtures/ssr/astro.config.mjs @@ -0,0 +1,12 @@ +import nodeServer from '@astrojs/node' +import sitemap from '@astrojs/sitemap'; +import { defineConfig } from 'astro/config'; + +export default defineConfig({ + integrations: [sitemap()], + site: 'http://example.com', + output: 'server', + adapter: nodeServer({ + mode: "standalone" + }) +}) diff --git a/packages/integrations/sitemap/test/fixtures/ssr/package.json b/packages/integrations/sitemap/test/fixtures/ssr/package.json new file mode 100644 index 000000000..4b5e6848d --- /dev/null +++ b/packages/integrations/sitemap/test/fixtures/ssr/package.json @@ -0,0 +1,10 @@ +{ + "name": "@test/sitemap-ssr", + "version": "0.0.0", + "private": true, + "dependencies": { + "astro": "workspace:*", + "@astrojs/node": "workspace:*", + "@astrojs/sitemap": "workspace:*" + } +} diff --git a/packages/integrations/sitemap/test/fixtures/ssr/src/pages/one.astro b/packages/integrations/sitemap/test/fixtures/ssr/src/pages/one.astro new file mode 100644 index 000000000..0c7fb90a7 --- /dev/null +++ b/packages/integrations/sitemap/test/fixtures/ssr/src/pages/one.astro @@ -0,0 +1,8 @@ +<html> + <head> + <title>One</title> + </head> + <body> + <h1>One</h1> + </body> +</html> diff --git a/packages/integrations/sitemap/test/fixtures/ssr/src/pages/two.astro b/packages/integrations/sitemap/test/fixtures/ssr/src/pages/two.astro new file mode 100644 index 000000000..e7ba9910e --- /dev/null +++ b/packages/integrations/sitemap/test/fixtures/ssr/src/pages/two.astro @@ -0,0 +1,8 @@ +<html> + <head> + <title>Two</title> + </head> + <body> + <h1>Two</h1> + </body> +</html> diff --git a/packages/integrations/sitemap/test/fixtures/static/astro.config.mjs b/packages/integrations/sitemap/test/fixtures/static/astro.config.mjs new file mode 100644 index 000000000..ae53a9342 --- /dev/null +++ b/packages/integrations/sitemap/test/fixtures/static/astro.config.mjs @@ -0,0 +1,18 @@ +import sitemap from '@astrojs/sitemap'; +import { defineConfig } from 'astro/config'; + +export default defineConfig({ + integrations: [sitemap({ + i18n: { + defaultLocale: 'it', + locales: { + it: 'it-IT', + de: 'de-DE', + } + } + })], + site: 'http://example.com', + redirects: { + '/redirect': '/' + }, +}) diff --git a/packages/integrations/sitemap/test/fixtures/static/deps.mjs b/packages/integrations/sitemap/test/fixtures/static/deps.mjs new file mode 100644 index 000000000..b24f26189 --- /dev/null +++ b/packages/integrations/sitemap/test/fixtures/static/deps.mjs @@ -0,0 +1 @@ +export { default as sitemap } from '@astrojs/sitemap'; diff --git a/packages/integrations/sitemap/test/fixtures/static/package.json b/packages/integrations/sitemap/test/fixtures/static/package.json new file mode 100644 index 000000000..ed5f3670b --- /dev/null +++ b/packages/integrations/sitemap/test/fixtures/static/package.json @@ -0,0 +1,9 @@ +{ + "name": "@test/sitemap-static", + "version": "0.0.0", + "private": true, + "dependencies": { + "astro": "workspace:*", + "@astrojs/sitemap": "workspace:*" + } +} diff --git a/packages/integrations/sitemap/test/fixtures/static/src/pages/123.astro b/packages/integrations/sitemap/test/fixtures/static/src/pages/123.astro new file mode 100644 index 000000000..115292de9 --- /dev/null +++ b/packages/integrations/sitemap/test/fixtures/static/src/pages/123.astro @@ -0,0 +1,8 @@ +<html> + <head> + <title>123</title> + </head> + <body> + <h1>123</h1> + </body> +</html> diff --git a/packages/integrations/sitemap/test/fixtures/static/src/pages/404.astro b/packages/integrations/sitemap/test/fixtures/static/src/pages/404.astro new file mode 100644 index 000000000..9e307c5c2 --- /dev/null +++ b/packages/integrations/sitemap/test/fixtures/static/src/pages/404.astro @@ -0,0 +1,8 @@ +<html> + <head> + <title>404</title> + </head> + <body> + <h1>404</h1> + </body> +</html> diff --git a/packages/integrations/sitemap/test/fixtures/static/src/pages/[lang]/manifest.ts b/packages/integrations/sitemap/test/fixtures/static/src/pages/[lang]/manifest.ts new file mode 100644 index 000000000..907b94a21 --- /dev/null +++ b/packages/integrations/sitemap/test/fixtures/static/src/pages/[lang]/manifest.ts @@ -0,0 +1,15 @@ +export const GET: APIRoute = async ({ params }) => { + const { lang } = params; + + return new Response(`I'm a route in the "${lang}" language.`); +}; + +export async function getStaticPaths() { + return ['it', 'en'].map((language) => { + return { + params: { + lang: language, + }, + }; + }); +} diff --git a/packages/integrations/sitemap/test/fixtures/static/src/pages/[slug].astro b/packages/integrations/sitemap/test/fixtures/static/src/pages/[slug].astro new file mode 100644 index 000000000..205633c76 --- /dev/null +++ b/packages/integrations/sitemap/test/fixtures/static/src/pages/[slug].astro @@ -0,0 +1,17 @@ +--- +export function getStaticPaths() { + return [ + { params: { slug: 'one' }, props: { title: 'One' } }, + { params: { slug: 'two' }, props: { title: 'Two' } }, + ] +} +--- + +<html> + <head> + <title>{Astro.props.title}</title> + </head> + <body> + <h1>{Astro.props.title}</h1> + </body> +</html> diff --git a/packages/integrations/sitemap/test/fixtures/static/src/pages/de/404.astro b/packages/integrations/sitemap/test/fixtures/static/src/pages/de/404.astro new file mode 100644 index 000000000..9e307c5c2 --- /dev/null +++ b/packages/integrations/sitemap/test/fixtures/static/src/pages/de/404.astro @@ -0,0 +1,8 @@ +<html> + <head> + <title>404</title> + </head> + <body> + <h1>404</h1> + </body> +</html> diff --git a/packages/integrations/sitemap/test/fixtures/static/src/pages/endpoint.json.ts b/packages/integrations/sitemap/test/fixtures/static/src/pages/endpoint.json.ts new file mode 100644 index 000000000..2e088376f --- /dev/null +++ b/packages/integrations/sitemap/test/fixtures/static/src/pages/endpoint.json.ts @@ -0,0 +1,6 @@ +export async function GET({}) { + return Response.json({ + name: 'Astro', + url: 'https://astro.build/', + }); +} diff --git a/packages/integrations/sitemap/test/fixtures/static/src/pages/products-by-id/[id].astro b/packages/integrations/sitemap/test/fixtures/static/src/pages/products-by-id/[id].astro new file mode 100644 index 000000000..b10438a68 --- /dev/null +++ b/packages/integrations/sitemap/test/fixtures/static/src/pages/products-by-id/[id].astro @@ -0,0 +1,11 @@ +--- +export async function getStaticPaths() { + return [ + { params: { id: '404' } }, + { params: { id: '405' } }, + ] +} + +const { id } = Astro.params +--- +<!DOCTYPE html><html> <head><title>Product #{id}</title></head> <body> <h1>Product #404</h1> <p>This is a product that just happens to have an ID of {id}. It is found!</p></body></html>
\ No newline at end of file diff --git a/packages/integrations/sitemap/test/fixtures/trailing-slash/astro.config.mjs b/packages/integrations/sitemap/test/fixtures/trailing-slash/astro.config.mjs new file mode 100644 index 000000000..82d25b854 --- /dev/null +++ b/packages/integrations/sitemap/test/fixtures/trailing-slash/astro.config.mjs @@ -0,0 +1,7 @@ +import sitemap from '@astrojs/sitemap'; +import { defineConfig } from 'astro/config'; + +export default defineConfig({ + integrations: [sitemap()], + site: 'http://example.com' +}) diff --git a/packages/integrations/sitemap/test/fixtures/trailing-slash/package.json b/packages/integrations/sitemap/test/fixtures/trailing-slash/package.json new file mode 100644 index 000000000..980e02e73 --- /dev/null +++ b/packages/integrations/sitemap/test/fixtures/trailing-slash/package.json @@ -0,0 +1,9 @@ +{ + "name": "@test/sitemap-trailing-slash", + "version": "0.0.0", + "private": true, + "dependencies": { + "astro": "workspace:*", + "@astrojs/sitemap": "workspace:*" + } +} diff --git a/packages/integrations/sitemap/test/fixtures/trailing-slash/src/pages/index.astro b/packages/integrations/sitemap/test/fixtures/trailing-slash/src/pages/index.astro new file mode 100644 index 000000000..5a29cbdbe --- /dev/null +++ b/packages/integrations/sitemap/test/fixtures/trailing-slash/src/pages/index.astro @@ -0,0 +1,8 @@ +<html> + <head> + <title>Index</title> + </head> + <body> + <h1>Index</h1> + </body> +</html>
\ No newline at end of file diff --git a/packages/integrations/sitemap/test/fixtures/trailing-slash/src/pages/one.astro b/packages/integrations/sitemap/test/fixtures/trailing-slash/src/pages/one.astro new file mode 100644 index 000000000..0c7fb90a7 --- /dev/null +++ b/packages/integrations/sitemap/test/fixtures/trailing-slash/src/pages/one.astro @@ -0,0 +1,8 @@ +<html> + <head> + <title>One</title> + </head> + <body> + <h1>One</h1> + </body> +</html> diff --git a/packages/integrations/sitemap/test/fixtures/trailing-slash/src/pages/two.astro b/packages/integrations/sitemap/test/fixtures/trailing-slash/src/pages/two.astro new file mode 100644 index 000000000..e7ba9910e --- /dev/null +++ b/packages/integrations/sitemap/test/fixtures/trailing-slash/src/pages/two.astro @@ -0,0 +1,8 @@ +<html> + <head> + <title>Two</title> + </head> + <body> + <h1>Two</h1> + </body> +</html> |