diff --git a/README.md b/README.md index 1b2da90..7b35a32 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ frontend: ### Static or prerendered pages -All pages must be server-rendered by default - you can't use `export const prerender = true` on any pages. As a workaround for static pages however, you can set a manual Amplify rewrite for every static route. +To use static pre-rendered pages (e.g. with `export const prerender = true` for `server`, or by default for `hybrid`), you will need to create an Amplify rewrite for every static route. For example, if you have a static `/about` page, create a rewrite of: @@ -130,16 +130,24 @@ For base path routes, create a rewrite of: `/base/about/ /base/about/index.html 200 (Rewrite)` +### Static files without extensions +Due to limitations with Amplify routing, if you want to serve static files without extensions (from the `public` folder), place them in a folder called `assets` (`/public/assets/`) and reference them in any pages or components with `/assets/filename`. + +Any other static files with extensions can be placed anywhere in `public`. + +### 404 Pages +Due to limitations with Amplify routing, custom 404 pages (e.g. `404.astro`) need to be SSRed (not prerendered) to work. + ## Features ### Supported - server and hybrid mode -- image optimization with `` and `` (tentative) +- image optimization with `` and `` - base paths - middleware ### Unsupported / Untested -- pre-rendered pages (without workaround above) +- Amplify Image optimization - ??? ## Monorepo Project Setup @@ -170,7 +178,8 @@ AWS Amplify build specification: ```yaml version: 1 applications: - - appRoot: demos/blog # change accordingly + # if you want to deploy another demo or change the configuration, you will need to change `amplify.yml` - changing the build spec won't override this file + - appRoot: demos/blog frontend: phases: preBuild: diff --git a/amplify.yml b/amplify.yml new file mode 100644 index 0000000..521a149 --- /dev/null +++ b/amplify.yml @@ -0,0 +1,20 @@ +version: 1 +applications: + - appRoot: demos/blog + frontend: + phases: + preBuild: + commands: + - npm i -g pnpm + - pnpm config set store-dir .pnpm-store + - pnpm i + build: + commands: + - pnpm run build + artifacts: + baseDirectory: .amplify-hosting + files: + - '**/*' + cache: + paths: + - .pnpm-store/**/* \ No newline at end of file diff --git a/demos/base-path/CHANGELOG.md b/demos/base-path/CHANGELOG.md index b9967cf..5e2e3cb 100644 --- a/demos/base-path/CHANGELOG.md +++ b/demos/base-path/CHANGELOG.md @@ -1,5 +1,12 @@ # base-path +## 0.0.6 + +### Patch Changes + +- Updated dependencies []: + - astro-aws-amplify@0.0.9 + ## 0.0.5 ### Patch Changes diff --git a/demos/base-path/package.json b/demos/base-path/package.json index ae02b86..07ee7ee 100644 --- a/demos/base-path/package.json +++ b/demos/base-path/package.json @@ -2,7 +2,7 @@ "name": "base-path", "type": "module", "private": true, - "version": "0.0.5", + "version": "0.0.6", "scripts": { "dev": "astro dev", "start": "astro dev", diff --git a/demos/blog/CHANGELOG.md b/demos/blog/CHANGELOG.md index e806718..7659090 100644 --- a/demos/blog/CHANGELOG.md +++ b/demos/blog/CHANGELOG.md @@ -1,5 +1,12 @@ # blog +## 0.0.6 + +### Patch Changes + +- Updated dependencies []: + - astro-aws-amplify@0.0.9 + ## 0.0.5 ### Patch Changes diff --git a/demos/blog/package.json b/demos/blog/package.json index e58940f..dcb9019 100644 --- a/demos/blog/package.json +++ b/demos/blog/package.json @@ -2,7 +2,7 @@ "name": "blog", "type": "module", "private": true, - "version": "0.0.5", + "version": "0.0.6", "scripts": { "dev": "astro dev", "start": "astro dev", diff --git a/demos/blog/public/assets/image b/demos/blog/public/assets/image new file mode 100644 index 0000000..74d4009 Binary files /dev/null and b/demos/blog/public/assets/image differ diff --git a/demos/blog/src/pages/404.astro b/demos/blog/src/pages/404.astro new file mode 100644 index 0000000..a6a16c6 --- /dev/null +++ b/demos/blog/src/pages/404.astro @@ -0,0 +1,19 @@ +--- +import BaseHead from "../components/BaseHead.astro"; +import Header from "../components/Header.astro"; +import Footer from "../components/Footer.astro"; +import { SITE_TITLE, SITE_DESCRIPTION } from "../consts"; +--- + + + + + + + +
+

404 - Page Not Found

+ +