+ {page.title ? (
+
+ {page.title}
+
+ ) : (
+
+ {page.summary?.content}
+
+ )}
{getPageVisibility(page).toLowerCase()}
diff --git a/src/lib/types.ts b/src/lib/types.ts
index 34abe7d1..0254f0a3 100644
--- a/src/lib/types.ts
+++ b/src/lib/types.ts
@@ -25,6 +25,7 @@ export enum PageVisibilityEnum {
Published = "published",
Scheduled = "scheduled",
Draft = "draft",
+ Crossbell = "crossbell",
}
export type PostOnSiteHome = {
diff --git a/src/models/page.model.ts b/src/models/page.model.ts
index 762ac4d6..d524a868 100644
--- a/src/models/page.model.ts
+++ b/src/models/page.model.ts
@@ -31,6 +31,7 @@ export async function createOrUpdatePage(input: {
/** Only needed when creating page */
isPost?: boolean
externalUrl?: string
+ applications?: string[]
}) {
if (!input.published) {
return await unidata.notes.set(
@@ -78,7 +79,10 @@ export async function createOrUpdatePage(input: {
.map((tag) => tag.trim())
.filter((tag) => tag) || []),
],
- applications: ["xlog"],
+ applications: [
+ "xlog",
+ ...(input.applications?.filter((app) => app !== "xlog") || []),
+ ],
...(input.slug && {
attributes: [
{
@@ -176,6 +180,7 @@ export async function getPagesBySite(input: {
}
const visibility = input.visibility || PageVisibilityEnum.All
+ const crossbell = visibility === PageVisibilityEnum.Crossbell
const options = {
source: "Crossbell Note",
@@ -183,8 +188,8 @@ export async function getPagesBySite(input: {
platform: "Crossbell",
limit: input.take || 1000,
filter: {
- tags: [...(input.tags || []), input.type],
- applications: ["xlog"],
+ tags: [...(input.tags || []), ...(crossbell ? [] : [input.type])],
+ applications: [...(crossbell ? [] : ["xlog"])],
},
cursor: "",
}
@@ -206,12 +211,14 @@ export async function getPagesBySite(input: {
cursor = res.cursor
} while (cursor)
- const local = getLocalPages({
- site: input.site,
- isPost: input.type === "post",
- })
- pages.list = pages.list.concat(local)
- pages.total += local.length
+ if (!crossbell) {
+ const local = getLocalPages({
+ site: input.site,
+ isPost: input.type === "post",
+ })
+ pages.list = pages.list.concat(local)
+ pages.total += local.length
+ }
if (pages?.list) {
switch (visibility) {
@@ -229,6 +236,11 @@ export async function getPagesBySite(input: {
(page) => +new Date(page.date_published) > +new Date(),
)
break
+ case PageVisibilityEnum.Crossbell:
+ pages.list = pages.list.filter(
+ (page) => !page.applications?.includes("xlog"),
+ )
+ break
}
pages.list = pages.list
.filter(
diff --git a/src/pages/dashboard/[subdomain]/editor.tsx b/src/pages/dashboard/[subdomain]/editor.tsx
index 900e419e..f2e2adb5 100644
--- a/src/pages/dashboard/[subdomain]/editor.tsx
+++ b/src/pages/dashboard/[subdomain]/editor.tsx
@@ -108,6 +108,7 @@ export default function SubdomainEditor() {
`${getSiteLink({ subdomain, domain: site.data?.custom_domain })}/${
values.slug
}`,
+ applications: page.data?.applications,
})
}