🐛(app-desk) force redirect on resources/[id]
When we use the static mode, Next.js want that we build our resource pages at build time. But we can't do that because users can create a resource at runtime. So we redirect thanks to ngnix when we see that a resource page is not found.
This commit is contained in:
@@ -8,6 +8,14 @@ server {
|
||||
try_files $uri index.html $uri/ =404;
|
||||
}
|
||||
|
||||
location /pads/ {
|
||||
error_page 404 /pads/[id]/;
|
||||
}
|
||||
|
||||
location /templates/ {
|
||||
error_page 404 /templates/[id]/;
|
||||
}
|
||||
|
||||
error_page 404 /404.html;
|
||||
location = /404.html {
|
||||
internal;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
output: 'export',
|
||||
trailingSlash: true,
|
||||
images: {
|
||||
unoptimized: true,
|
||||
},
|
||||
|
||||
@@ -21,8 +21,12 @@ export const Menu = () => {
|
||||
$justify="space-between"
|
||||
>
|
||||
<Box className="pt-l" $direction="column" $gap="0.8rem">
|
||||
<MenuItem Icon={IconPad} label={t('Pad')} href="/" alias={['/pads']} />
|
||||
<MenuItem Icon={IconTemplate} label={t('Template')} href="/templates" />
|
||||
<MenuItem Icon={IconPad} label={t('Pad')} href="/" alias={['/pads/']} />
|
||||
<MenuItem
|
||||
Icon={IconTemplate}
|
||||
label={t('Template')}
|
||||
href="/templates/"
|
||||
/>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user