-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublishToAtmosphere.ts
More file actions
41 lines (36 loc) · 1.27 KB
/
Copy pathpublishToAtmosphere.ts
File metadata and controls
41 lines (36 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import fs from "node:fs/promises";
import { createOrUpdateStandardSite } from "@mastrojs/atproto";
import type { Publication } from "@mastrojs/atproto";
import { readMarkdownFiles } from "@mastrojs/markdown";
const identifier = "tobbe.dev";
const password = process.env.ATPROTO_PASSWORD;
const pubUrl = new URL("https://tlundberg.com/blog/");
const publication: Publication = {
url: pubUrl,
name: "Tobbe Lundberg's place on teh Intarwebs",
description: "My personal blog",
// Optional square image for the publication, should be at least 256x256:
icon: {
blob: await fs.readFile("routes/logo_tobbe.png"),
mimeType: "image/png",
},
// Optional RGB colors, make sure you have enough contrast:
basicTheme: {
background: { r: 0, g: 0, b: 0 },
foreground: { r: 255, g: 255, b: 255 },
accent: { r: 92, g: 154, b: 255 }, // button color
accentForeground: { r: 0, g: 0, b: 0 }, // button text
},
};
interface PostMeta {
title: string;
date: string;
[index: string]: string;
}
const posts = await readMarkdownFiles<PostMeta>("data/posts/*.md");
const docs = posts.map((p) => ({
title: p.meta.title,
publishedAt: new Date(p.meta.date),
url: new URL(p.slug + "/", pubUrl),
}));
await createOrUpdateStandardSite({ identifier, password }, publication, docs);