From 22648a0528a6a48ab18e625d3576e90dbddd79ce Mon Sep 17 00:00:00 2001 From: Rufus Pollock Date: Wed, 28 Jul 2021 23:23:28 +0200 Subject: [PATCH] [site,#572][s]: refactor existing site content into the content directory. * Can get rid of existing pages as now our generic markdown / mdx loader at the root \[...slug\].js catches everything * Convert gallery to a markdown file --- .../docs/index.md => content/docs.md} | 0 .../{markdowns => content}/docs/components.md | 0 .../{markdowns => content}/docs/references.md | 0 site/content/gallery.md | 5 ++ .../tutorial-doc => content}/learn.md | 2 +- site/pages/docs/[[...id]].js | 52 ------------------- site/pages/gallery.js | 13 ----- site/pages/learn.js | 30 ----------- 8 files changed, 6 insertions(+), 96 deletions(-) rename site/{markdowns/docs/index.md => content/docs.md} (100%) rename site/{markdowns => content}/docs/components.md (100%) rename site/{markdowns => content}/docs/references.md (100%) create mode 100644 site/content/gallery.md rename site/{markdowns/tutorial-doc => content}/learn.md (98%) delete mode 100644 site/pages/docs/[[...id]].js delete mode 100644 site/pages/gallery.js delete mode 100644 site/pages/learn.js diff --git a/site/markdowns/docs/index.md b/site/content/docs.md similarity index 100% rename from site/markdowns/docs/index.md rename to site/content/docs.md diff --git a/site/markdowns/docs/components.md b/site/content/docs/components.md similarity index 100% rename from site/markdowns/docs/components.md rename to site/content/docs/components.md diff --git a/site/markdowns/docs/references.md b/site/content/docs/references.md similarity index 100% rename from site/markdowns/docs/references.md rename to site/content/docs/references.md diff --git a/site/content/gallery.md b/site/content/gallery.md new file mode 100644 index 00000000..d306df50 --- /dev/null +++ b/site/content/gallery.md @@ -0,0 +1,5 @@ +--- +title: Gallery +--- + +Come back soon! diff --git a/site/markdowns/tutorial-doc/learn.md b/site/content/learn.md similarity index 98% rename from site/markdowns/tutorial-doc/learn.md rename to site/content/learn.md index 97b79ce6..39a1d196 100644 --- a/site/markdowns/tutorial-doc/learn.md +++ b/site/content/learn.md @@ -10,7 +10,7 @@ Even still, there's a high learning curve before you can build a proper applicat Think about how apps are created as a frontend developer. You create some files, write some code, load some data and then simply deploy it. We don't have to worry about Docker, Kubernetes, data storage, Postgres etc. -Portal.JS logo +Portal.JS logo That's exactly what we do with Portal.js. Built in pure Javascript and React on top of the awesome Next.js framework. Here are some the cool features Portal.js brings to the table: diff --git a/site/pages/docs/[[...id]].js b/site/pages/docs/[[...id]].js deleted file mode 100644 index 11ec2bb1..00000000 --- a/site/pages/docs/[[...id]].js +++ /dev/null @@ -1,52 +0,0 @@ -import path from 'path' -import * as fs from 'fs' -import Link from 'next/link' - -import Layout from '../../components/layout' -import Prose from '../../components/prose' -import { formatMD } from '../../lib/utils' - -export default function Docs({ title, mdFile }) { - return ( - - - - - ) -} - -const postsDirectory = 'markdowns/docs' - -export async function getStaticProps({params}) { - const postId = params.id ? params.id : 'index' - const mdFilePath = path.join(postsDirectory, postId + '.md') - const mdFile = await formatMD(mdFilePath) - return { - props: { - mdFile - } - } -} - -export async function getStaticPaths() { - const fileNames = fs.readdirSync(postsDirectory) - const paths = fileNames.map(fileName => { - if (fileName == 'index.md') { - return { - params: { - id: null - } - } - } else { - return { - params: { - id: [ fileName.replace(/\.md$/, '') ] - } - } - } - }) - return { - paths: paths, - fallback: false - } -} diff --git a/site/pages/gallery.js b/site/pages/gallery.js deleted file mode 100644 index 72433701..00000000 --- a/site/pages/gallery.js +++ /dev/null @@ -1,13 +0,0 @@ -import Layout from '../components/layout' -import Prose from '../components/prose' - -export default function Gallery() { - - return ( - - -

Come back soon!

-
-
- ) -} diff --git a/site/pages/learn.js b/site/pages/learn.js deleted file mode 100644 index 10a8a6b1..00000000 --- a/site/pages/learn.js +++ /dev/null @@ -1,30 +0,0 @@ -import Link from 'next/link' -import path from 'path' - -import Layout from '../components/layout' -import Prose from '../components/prose' -import { formatMD } from '../lib/utils' - -export default function Docs({ mdFile }) { - return ( - - -

- - - -

-
-
- ) -} - -export async function getStaticProps() { - const mdFilePath = path.join(process.cwd(), "markdowns/tutorial-doc/learn.md") - const mdFile = await formatMD(mdFilePath) - return { - props: { - mdFile - } - } -}