summaryrefslogtreecommitdiff
path: root/packages/integrations/netlify/src
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthew@skypack.dev> 2022-04-06 16:21:46 -0400
committerGravatar GitHub <noreply@github.com> 2022-04-06 16:21:46 -0400
commit672a553eccbc3a9e9bc7bd9ecce6f60c45b8b0c9 (patch)
treed902da8628e4de429286f4b73aa80d454a5c8a18 /packages/integrations/netlify/src
parent10bc76a139622e63caa81f072b87843cc66f9e0a (diff)
downloadastro-672a553eccbc3a9e9bc7bd9ecce6f60c45b8b0c9.tar.gz
astro-672a553eccbc3a9e9bc7bd9ecce6f60c45b8b0c9.tar.zst
astro-672a553eccbc3a9e9bc7bd9ecce6f60c45b8b0c9.zip
Fix Netlify adapter and dynamic routes (#3011)
* Fix Netlify adapter and dynamic routes * Changeset
Diffstat (limited to 'packages/integrations/netlify/src')
-rw-r--r--packages/integrations/netlify/src/index.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/packages/integrations/netlify/src/index.ts b/packages/integrations/netlify/src/index.ts
index 181303e33..aa1b5d33c 100644
--- a/packages/integrations/netlify/src/index.ts
+++ b/packages/integrations/netlify/src/index.ts
@@ -53,6 +53,10 @@ function netlifyFunctions({ dist }: NetlifyFunctionsOptions = {}): AstroIntegrat
if (route.pathname) {
_redirects += `
${route.pathname} /.netlify/functions/${entryFile} 200`;
+ } else {
+ const pattern = '/' + route.segments.map(([part]) => part.dynamic ? '*' : part.content).join('/');
+ _redirects += `
+${pattern} /.netlify/functions/${entryFile} 200`;
}
}