AP: fix object generation
This commit is contained in:
parent
8f73cd8106
commit
48368ae6e4
|
@ -1,3 +1,4 @@
|
||||||
|
import path from "path";
|
||||||
import { Page, PostMetadata } from "../metadata";
|
import { Page, PostMetadata } from "../metadata";
|
||||||
import * as util from "../util";
|
import * as util from "../util";
|
||||||
|
|
||||||
|
@ -6,7 +7,14 @@ const baseURL = process.env.BASE_URL || "shadowfacts.net";
|
||||||
export default async function activitypub(posts: Page[]) {
|
export default async function activitypub(posts: Page[]) {
|
||||||
for (const post of posts) {
|
for (const post of posts) {
|
||||||
const object = postObject(post);
|
const object = postObject(post);
|
||||||
util.write(`ap/posts/${post.metadata.permalink}.json`, JSON.stringify(object));
|
const dir = path.dirname(post.metadata.permalink);
|
||||||
|
const base = path.basename(post.metadata.permalink);
|
||||||
|
const dest = path.format({
|
||||||
|
dir,
|
||||||
|
name: base,
|
||||||
|
ext: ".json"
|
||||||
|
});
|
||||||
|
util.write(dest, JSON.stringify(object));
|
||||||
}
|
}
|
||||||
|
|
||||||
util.write("ap/actor", JSON.stringify(actorObject()))
|
util.write("ap/actor", JSON.stringify(actorObject()))
|
||||||
|
|
Loading…
Reference in New Issue