[READ-ONLY] Mirror of https://github.com/danielroe/roe.dev. This is the code and content for my personal website, built in Nuxt.
roe.dev
1const SITE_URL = 'https://roe.dev'
2
3function yamlEscape (str: string): string {
4 return str.replace(/\\/g, '\\\\').replace(/"/g, '\\"')
5}
6
7export function mdFrontmatter (path: string, meta: { title: string, description?: string }): string {
8 const lines = ['---']
9 lines.push(`title: "${yamlEscape(meta.title)}"`)
10 if (meta.description) {
11 lines.push(`description: "${yamlEscape(meta.description)}"`)
12 }
13 lines.push(`url: ${SITE_URL}${path}`)
14 lines.push('---')
15 return lines.join('\n')
16}
17
18export function mdResponse (content: string): Response {
19 return new Response(content, {
20 headers: { 'Content-Type': 'text/markdown; charset=utf-8' },
21 })
22}
23
24export function formatDate (dateStr: string): string {
25 const date = new Date(dateStr)
26 return date.toLocaleDateString('en-GB', {
27 day: 'numeric',
28 month: 'long',
29 year: 'numeric',
30 })
31}
32
33export type { Talk } from '#shared/cms/talks'
34
35export interface Conference {
36 name: string
37 dates: string
38 link?: string
39 location?: string
40}