+
+
+)
+
+export async function getStaticProps() {
+ const allPostsData = getSortedPostsData()
+ return {
+ props: {
+ allPostsData
+ }
+ }
+}
+
+export default Home
diff --git a/example/pages/posts/[id].js b/example/pages/posts/[id].js
new file mode 100644
index 0000000..cafc88f
--- /dev/null
+++ b/example/pages/posts/[id].js
@@ -0,0 +1,39 @@
+import Layout from '../../components/Layout'
+import { getAllPostIds, getPostData } from '../../lib/posts'
+import Head from 'next/head'
+import Date from '../../components/Date'
+import utilStyles from '../../styles/utils.module.css'
+
+const Post = ({ postData }) => (
+
+
+ {postData.title}
+
+
+
{postData.title}
+
+
+
+
+
+
+)
+
+export async function getStaticPaths() {
+ const paths = getAllPostIds()
+ return {
+ paths,
+ fallback: false
+ }
+}
+
+export async function getStaticProps({ params }) {
+ const postData = await getPostData(params.id)
+ return {
+ props: {
+ postData
+ }
+ }
+}
+
+export default Post
diff --git a/example/posts/dps.md b/example/posts/dps.md
new file mode 100644
index 0000000..878a33d
--- /dev/null
+++ b/example/posts/dps.md
@@ -0,0 +1,12 @@
+---
+title: "DPS: Develop, Preview, Ship"
+date: "2020-01-02"
+---
+
+[ZEIT Now](https://zeit.co/) supports the **DPS** workflow: **D**evelop, **P**review, and **S**hip:
+
+- **Develop**: Write code in Next.js. Keep the development server running and take advantage of its hot code reloading feature.
+- **Preview**: Every time you push changes to a branch on GitHub / GitLab / BitBucket, ZEIT Now automatically creates a new deployment with a unique URL.
+- **Ship**: When you’re ready to ship, merge the pull request to your default branch (e.g. `master`). ZEIT Now will automatically create a production deployment.
+
+By using the DPS workflow, in addition to doing code reviews, you can do *deployment previews*. Each deployment creates a unique URL that can be shared or used for integration tests.
\ No newline at end of file
diff --git a/example/posts/pre-rendering.md b/example/posts/pre-rendering.md
new file mode 100644
index 0000000..78cc081
--- /dev/null
+++ b/example/posts/pre-rendering.md
@@ -0,0 +1,11 @@
+---
+title: "Two Forms of Pre-rendering"
+date: "2020-01-01"
+---
+
+[Next.js](https://nextjs.org/) has two forms of pre-rendering: **Static Generation** and **Server-side Rendering**. The difference is in **when** it generates the HTML for a page.
+
+- **Static Generation (Recommended)**: The HTML is generated at **build time** and will be reused on each request.
+- **Server-side Rendering**: The HTML is generated on **each request**.
+
+Importantly, Next.js lets you **choose** which pre-rendering form you'd like to use for each page. You can create a "hybrid" Next.js app by using Static Generation for most pages and using Server-side Rendering for others.
\ No newline at end of file
diff --git a/example/public/favicon.ico b/example/public/favicon.ico
new file mode 100644
index 0000000..4965832
Binary files /dev/null and b/example/public/favicon.ico differ
diff --git a/example/public/images/profile.jpg b/example/public/images/profile.jpg
new file mode 100644
index 0000000..928d903
Binary files /dev/null and b/example/public/images/profile.jpg differ
diff --git a/example/styles/global.css b/example/styles/global.css
new file mode 100644
index 0000000..9e1b0fb
--- /dev/null
+++ b/example/styles/global.css
@@ -0,0 +1,27 @@
+html,
+body {
+ padding: 0;
+ margin: 0;
+ font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
+ Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
+ line-height: 1.6;
+ font-size: 18px;
+}
+
+* {
+ box-sizing: border-box;
+}
+
+a {
+ color: #0070f3;
+ text-decoration: none;
+}
+
+a:hover {
+ text-decoration: underline;
+}
+
+img {
+ max-width: 100%;
+ display: block;
+}
diff --git a/example/styles/utils.module.css b/example/styles/utils.module.css
new file mode 100644
index 0000000..46a77f3
--- /dev/null
+++ b/example/styles/utils.module.css
@@ -0,0 +1,52 @@
+.heading2Xl {
+ font-size: 2.5rem;
+ line-height: 1.2;
+ font-weight: 800;
+ letter-spacing: -0.05rem;
+ margin: 1rem 0;
+}
+
+.headingXl {
+ font-size: 2rem;
+ line-height: 1.3;
+ font-weight: 800;
+ letter-spacing: -0.05rem;
+ margin: 1rem 0;
+}
+
+.headingLg {
+ font-size: 1.5rem;
+ line-height: 1.4;
+ margin: 1rem 0;
+}
+
+.headingMd {
+ font-size: 1.2rem;
+ line-height: 1.5;
+}
+
+.borderCircle {
+ border-radius: 9999px;
+}
+
+.colorInherit {
+ color: inherit;
+}
+
+.padding1px {
+ padding-top: 1px;
+}
+
+.list {
+ list-style: none;
+ padding: 0;
+ margin: 0;
+}
+
+.listItem {
+ margin: 0 0 1.25rem;
+}
+
+.lightText {
+ color: #999;
+}