forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update with-zones example (vercel#8459)
* Add more pages to the 'blog' zone - New dynamic page `pages/blog/post/[id].js` - `pages/blog.js` moved to `pages/blog/index.js` * Update Now and Next configs to support both `now dev` and `next dev` - Set `assetPrefix` dynamically to either `/blog` or `''`. - Update package.json scripts for both 'home' and 'blog' apps, support `yarn dev` in both of them. * Update example description in README * Fix formatting issues * Make `/static` assets work in the 'blog' app * Add routing rule for `/blog/static` to now.json * Shorten README I reverted it back to the state of 233152e and then updated it with info on recent changes of the `with-zones` example. * Use `continue: true` in now.json Applies suggestions from code review. Co-Authored-By: Joe Haddad <[email protected]> * Fix JSON formatting * Add routing rule for `_next` and `static` folders * Update README of with-zones example slightly Applies suggestions from code review. Co-Authored-By: Joe Haddad <[email protected]> * Remove unnecessary "dest" from `now.json` Co-Authored-By: Joe Haddad <[email protected]>
- Loading branch information
Showing
9 changed files
with
68 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
const assetPrefix = process.env.BUILDING_FOR_NOW ? '/blog' : '' | ||
|
||
module.exports = { | ||
target: 'serverless', | ||
assetPrefix: '/blog' | ||
assetPrefix, | ||
env: { | ||
ASSET_PREFIX: assetPrefix | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import Link from 'next/link' | ||
|
||
export default () => ( | ||
<div> | ||
<h3>This is our blog</h3> | ||
<ul> | ||
<li> | ||
<Link href='/blog/post/[id]' as='/blog/post/1'> | ||
<a>Post 1</a> | ||
</Link> | ||
</li> | ||
<li> | ||
<Link href='/blog/post/[id]' as='/blog/post/2'> | ||
<a>Post 2</a> | ||
</Link> | ||
</li> | ||
</ul> | ||
<a href='/'>Home</a> | ||
<div> | ||
<img width={200} src={`${process.env.ASSET_PREFIX}/static/nextjs2.png`} /> | ||
</div> | ||
</div> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import Link from 'next/link' | ||
import { useRouter } from 'next/router' | ||
|
||
export default () => { | ||
const router = useRouter() | ||
return ( | ||
<div> | ||
<h3>Post #{router.query.id}</h3> | ||
<p>Lorem ipsum</p> | ||
<Link href='/blog'> | ||
<a>Back to blog</a> | ||
</Link> | ||
</div> | ||
) | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters