Skip to content

Commit

Permalink
Update astro-disable-admin-ui-in-production.mdoc (#635)
Browse files Browse the repository at this point in the history
  • Loading branch information
barelyhuman authored Sep 13, 2023
1 parent 303e845 commit 8b1aef4
Showing 1 changed file with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,29 @@ export const prerender = false

You will need to do the same for the `api/keystatic` routes:

```jsx
```diff
// src/pages/api/keystatic/[...params].ts
import { makeHandler } from '@keystatic/astro/api'
import keystaticConfig from '../../../../keystatic.config'
+ import { APIContext } from 'astro'

- export const all = makeHandler({
- config: keystaticConfig,
- })

+ export const all = ({ ...params }: APIContext) => {
+ if (import.meta.env.MODE === 'production') {
+ return params.redirect('/', 307)
+ }

+ return makeHandler({
+ config: keystaticConfig,
+ })(params)
+}

export const all = makeHandler({
config: keystaticConfig,
})

export const prerender = false

+ if (import.meta.env.MODE === 'production') {
+ return Astro.redirect('/')
+ }
```

## Excluding routes from sitemap
Expand Down

3 comments on commit 8b1aef4

@vercel
Copy link

@vercel vercel bot commented on 8b1aef4 Sep 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

keystar-ui – ./design-system/docs

keystar-ui.vercel.app
keystar-ui-thinkmill-labs.vercel.app
keystar-ui-git-main-thinkmill-labs.vercel.app
voussoir.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 8b1aef4 Sep 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

keystatic – ./dev-projects/next-app

keystatic-git-main-thinkmill-labs.vercel.app
keystatic-thinkmill-labs.vercel.app
keystatic.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 8b1aef4 Sep 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.