+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+
+ Home
+
+
+ );
+};
+
+export default About;
\ No newline at end of file
diff --git a/pages/blog/[slug].jsx b/pages/blog/[slug].jsx
new file mode 100644
index 0000000..19e31dd
--- /dev/null
+++ b/pages/blog/[slug].jsx
@@ -0,0 +1,55 @@
+
+import Head from 'next/head';
+import Layout from '../../components/Layout';
+import { getAllPosts, getPostBySlug } from '../../utils/api';
+import markdownToHtml from '../../utils/markdownToHTML';
+
+const Post = ({ post }) => {
+ return (
+
+
+
+ {post.title}
+
+
+
+
+ );
+};
+
+
+export async function getStaticProps({ params }) {
+ const post = getPostBySlug(params.slug, [
+ 'title',
+ 'slug',
+ 'author',
+ 'content',
+ ]);
+ const content = await markdownToHtml(post.content || '');
+
+ return {
+ props: {
+ post: {
+ ...post,
+ content,
+ },
+ },
+ };
+}
+
+export async function getStaticPaths() {
+ const posts = getAllPosts(['slug']);
+
+ return {
+ paths: posts.map((post) => {
+ return {
+ params: {
+ slug: post.slug,
+ },
+ };
+ }),
+ fallback: false,
+ };
+}
+
+export default Post;
\ No newline at end of file
diff --git a/pages/blog/index.jsx b/pages/blog/index.jsx
new file mode 100644
index 0000000..9645125
--- /dev/null
+++ b/pages/blog/index.jsx
@@ -0,0 +1,41 @@
+import Head from 'next/head';
+import Link from 'next/link';
+import { getAllPosts } from '../../utils/api';
+
+export async function getStaticProps() {
+ const posts = await getAllPosts(['slug', 'title']);
+
+ return {
+ props: {
+ posts
+ },
+ };
+}
+
+const Blog = ({ posts }) => {
+ return (
+
+
+ Blogs
+
+
+
Blogs
+
+
+ {posts.map((post) => (
+
+
+ {post.title}
+
+
+ ))}
+
+
+
+ Home
+
+
+ );
+};
+
+export default Blog;
\ No newline at end of file
diff --git a/pages/index.js b/pages/index.js
index dc5a1cc..a938845 100644
--- a/pages/index.js
+++ b/pages/index.js
@@ -1,123 +1,37 @@
import Head from 'next/head'
-import Image from 'next/image'
-import { Inter } from '@next/font/google'
-import styles from '../styles/Home.module.css'
+import Link from 'next/link';
-const inter = Inter({ subsets: ['latin'] })
+export async function getStaticProps() {
+ // get some data from some CMS
+ return {
+ props: {
+ heading: 'Hello World - Next JS workshop'
+ }
+ };
+}
-export default function Home() {
+export default function Home({ heading }) {
return (
<>
- Create Next App
-
+ Next JS Workshop
+
-
-