From efd9e0bebd435cb99faf1b99217c3d77afc1fe2e Mon Sep 17 00:00:00 2001 From: khalilcodes Date: Fri, 17 Jun 2022 14:30:39 +0300 Subject: [PATCH 1/2] [site/nav][xs]: add notes link to navbar --- site/config/navLinks.js | 1 + 1 file changed, 1 insertion(+) diff --git a/site/config/navLinks.js b/site/config/navLinks.js index 36ad060..8bba04d 100644 --- a/site/config/navLinks.js +++ b/site/config/navLinks.js @@ -3,6 +3,7 @@ const navLinks = [ { href: '/guide', name: 'Guide' }, { href: '/claims', name: 'Claims' }, { href: '/library', name: 'Library' }, + { href: '/notes', name: 'Notes' }, { href: '/webinars', name: 'Webinars' }, { href: '/contribute', name: 'Contribute' }, ] From 491046a173f06b76fe142e65caa77e34382ee353 Mon Sep 17 00:00:00 2001 From: khalilcodes Date: Fri, 17 Jun 2022 14:31:29 +0300 Subject: [PATCH 2/2] [site/pages][s]: create notes page --- site/pages/notes.js | 68 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 site/pages/notes.js diff --git a/site/pages/notes.js b/site/pages/notes.js new file mode 100644 index 0000000..4bc7dde --- /dev/null +++ b/site/pages/notes.js @@ -0,0 +1,68 @@ +import Link from "next/link"; +import { allOtherPages } from "contentlayer/generated" +import { YOUTUBE_REGEX } from "lib/constants"; + +export async function getStaticProps() { + const posts = allOtherPages + .filter((page) => page._raw.sourceFileDir === "notes") + .map((page) => { + return { + title: page.title || null, + description: page.description || null, + date: page.date, + image: page.image || null, + youtube: page.youtube || null, + link: `/${page._raw.flattenedPath}`, + }; + }) + .sort((a, b) => new Date(b.date) - new Date(a.date)); + + return { props: { posts } }; +} + +export default function Notes({ posts }) { + return ( +
+
+
+

+ Our latest articles and explorations. +

+
+
+ {posts && posts.map(({ title, description, image, youtube, link }) => ( + title && description && + (
+
+ {image && {title}} +
+ +
) + ))} +
+
+
+ ); +} \ No newline at end of file