1
0
Fork 0
mirror of https://github.com/mat-1/matdoesdev.git synced 2025-08-02 14:46:04 +00:00

Revert "add markdown support to every page"

This reverts commit 60d1103719.
This commit is contained in:
mat 2023-12-09 15:57:09 -06:00
parent 60d1103719
commit bf8a6ec2cb
7 changed files with 12 additions and 97 deletions

View file

@ -6,6 +6,11 @@ import fs from 'fs'
export const prerender = true
export interface APIBlogPost {
title: string
html: string
}
const extContentTypes: Record<string, string> = {
png: 'image/png',
}

View file

@ -1,4 +1,4 @@
import { type RequestHandler } from '@sveltejs/kit'
import { json, type RequestHandler } from '@sveltejs/kit'
export const prerender = true

View file

@ -1,27 +0,0 @@
import { type RequestHandler } from '@sveltejs/kit'
export const prerender = true
const content = `# matdoesdev
I'm mat, I do full-stack software development.
This portfolio contains my blog posts and links to some of the projects I've made.
## Socials
- [GitHub](//github.com/mat-1)
- [Matrix](//matrix.to/#/@mat:matdoes.dev)
- [Ko-fi](//ko-fi.com/matdoesdev)
## Links
- [Blog](/blog.md)
- [Projects](/projects.md)`
export const GET: RequestHandler = async ({}) => {
return new Response(content, {
headers: {
'content-type': 'text/plain',
},
})
}

View file

@ -3,6 +3,12 @@ import { error, json, type RequestHandler } from '@sveltejs/kit'
export const prerender = true
export interface APIBlogPost {
title: string
published: string
html: string
}
export const GET: RequestHandler = async ({ params }) => {
const { slug } = params
if (!slug) throw new Error('No slug')

View file

@ -1,26 +0,0 @@
import { getPost } from '$lib/blog'
import { error, json, type RequestHandler } from '@sveltejs/kit'
import fs from 'fs/promises'
export const prerender = true
export const GET: RequestHandler = async ({ params }) => {
const { slug } = params
if (!slug) throw new Error('No slug')
const post = await getPost(slug)
if (post === null) throw error(404, 'Not found')
const svxSource = await fs.readFile(`src/routes/${slug}/index.svx`, 'utf8')
const mdSource = svxSource.split('---\n\n')[1]
let content = `# ${post.title}\n\n`
content += `_Published: ${new Date(post.published).toLocaleDateString('en-US')}_\n\n`
content += mdSource
return new Response(content, {
headers: {
'content-type': 'text/plain',
},
})
}

View file

@ -1,21 +0,0 @@
import type { RequestHandler } from '@sveltejs/kit'
import type { BlogPostPreview } from '../blog.json/+server'
export const prerender = true
export const GET: RequestHandler = async ({ fetch }) => {
const posts: BlogPostPreview[] = await fetch('/blog.json').then((res) => res.json())
let content = '# Blog\n\n'
for (const post of posts) {
const publishedDate = new Date(post.published).toLocaleDateString('en-US')
content += `- [${publishedDate} - ${post.title}](/${post.slug}.md)\n`
}
return new Response(content, {
headers: {
'content-type': 'text/plain',
},
})
}

View file

@ -1,22 +0,0 @@
import type { RequestHandler } from '@sveltejs/kit'
import projects from '../_projects.json'
export const prerender = true
export const GET: RequestHandler = async ({ fetch }) => {
let content = '# Projects\n\n'
for (const project of projects) {
if (project.href) {
content += `- [${project.name}](${project.href})\n`
} else {
content += `- ${project.name}\n`
}
}
return new Response(content, {
headers: {
'content-type': 'text/plain',
},
})
}