55 lines
1.5 KiB
Plaintext
55 lines
1.5 KiB
Plaintext
---
|
|
title: Blog
|
|
description: Jan is a ChatGPT-alternative that runs on your own computer, with a local API server.
|
|
keywords:
|
|
[
|
|
Jan,
|
|
Customizable Intelligence, LLM,
|
|
local AI,
|
|
privacy focus,
|
|
free and open source,
|
|
private and offline,
|
|
conversational AI,
|
|
no-subscription fee,
|
|
large language models,
|
|
architecture,
|
|
]
|
|
---
|
|
|
|
import Blog from "@/components/Blog"
|
|
import fs from 'fs'
|
|
import path from 'path'
|
|
import matter from 'gray-matter'
|
|
import { format } from 'date-fns'
|
|
|
|
<Blog/>
|
|
|
|
export const getStaticProps = async() => {
|
|
const blogPosts = await fs.readdirSync(path.join(process.cwd(), 'src/pages/post')).filter((file) => {
|
|
return path.extname(file).toLowerCase() === ".mdx" && !file.startsWith('index')
|
|
})
|
|
const allBlogPosts = []
|
|
|
|
for (const item of blogPosts) {
|
|
const content = fs.readFileSync(path.join(process.cwd(), `src/pages/post/${item}`), "utf8")
|
|
const frontmatter = matter(content)
|
|
if(!frontmatter.data.unlisted) {
|
|
allBlogPosts.push({
|
|
title: frontmatter.data?.title || null,
|
|
url: '/post/' + item?.replace(/\.mdx?/, ''),
|
|
description: frontmatter.data?.description || null,
|
|
date: String(frontmatter.data?.date) || null,
|
|
tags: frontmatter.data.tags?.split(', ') || null,
|
|
author: frontmatter.data?.author || null,
|
|
categories: frontmatter.data.categories?.split(', ') || null,
|
|
})
|
|
}
|
|
allBlogPosts.sort((a, b) => new Date(b.date) - new Date(a.date))
|
|
}
|
|
|
|
return {
|
|
props: {
|
|
ssg: allBlogPosts
|
|
},
|
|
}
|
|
} |