[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
This commit is contained in:
Rufus Pollock
2021-07-28 23:23:28 +02:00
parent 8c3b1bccd3
commit 22648a0528
8 changed files with 6 additions and 96 deletions

5
site/content/gallery.md Normal file
View File

@@ -0,0 +1,5 @@
---
title: Gallery
---
Come back soon!

View File

@@ -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. 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.
<img src="/logo.svg" alt="Portal.JS logo" style="height: 40px" /> <img src="/logo.svg" alt="Portal.JS logo" style={{height: '40px'}} />
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: 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:

View File

@@ -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 (
<Layout title="Portal.js Documentation - {title}">
<Prose mdFile={mdFile}>
</Prose>
</Layout>
)
}
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
}
}

View File

@@ -1,13 +0,0 @@
import Layout from '../components/layout'
import Prose from '../components/prose'
export default function Gallery() {
return (
<Layout title="Portal.js Gallery">
<Prose>
<p className="text-center">Come back soon!</p>
</Prose>
</Layout>
)
}

View File

@@ -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 (
<Layout title="Portal.js - Learn">
<Prose mdFile={mdFile}>
<p className="text-center">
<Link href="/references">
<button>Next Page</button>
</Link>
</p>
</Prose>
</Layout>
)
}
export async function getStaticProps() {
const mdFilePath = path.join(process.cwd(), "markdowns/tutorial-doc/learn.md")
const mdFile = await formatMD(mdFilePath)
return {
props: {
mdFile
}
}
}