+ About the Library of Alexandria
+ {#if isVersionKnown}
+ Version: {appVersion}
+ {/if}
+
+
+
- Alexandria is a reader and writer for curated publications (in Asciidoc), and will eventually also support long-form articles (Markdown) and wiki pages (Asciidoc). It is produced by the GitCitadel project team.
+ Alexandria is a reader and writer for curated publications (in Asciidoc), wiki pages (Asciidoc), and will eventually also support long-form articles (Markdown). It is produced by the GitCitadel project team.
@@ -34,11 +44,11 @@
- If you click on a card, which represents a 30040 index event, the associated reading view opens to the publication. The app then pulls all of the content events (30041s), in the order in which they are indexed, and displays them as a single document.
+ If you click on a card, which represents a 30040 index event, the associated reading view opens to the publication. The app then pulls all of the content events (30041s and 30818s for wiki pages), in the order in which they are indexed, and displays them as a single document.
- Each 30041 section is also a level in the table of contents, which can be accessed from the floating icon top-left in the reading view. This allows for navigation within the publication. (This functionality has been temporarily disabled.)
+ Each content section (30041 or 30818) is also a level in the table of contents, which can be accessed from the floating icon top-left in the reading view. This allows for navigation within the publication. (This functionality has been temporarily disabled.)
@@ -93,6 +103,16 @@
+
+ For wiki pages
+
+
+ Alexandria now supports wiki pages (kind 30818), allowing for collaborative knowledge bases and documentation. Wiki pages use the same Asciidoc format as other publications but are specifically designed for interconnected, evolving content.
+
+
+
+ Wiki pages can be linked to from other publications and can contain links to other wiki pages, creating a web of knowledge that can be navigated and explored.
+
diff --git a/src/routes/publication/+page.svelte b/src/routes/publication/+page.svelte
index b566965..e6f532d 100644
--- a/src/routes/publication/+page.svelte
+++ b/src/routes/publication/+page.svelte
@@ -4,20 +4,62 @@
import type { PageData } from "./$types";
import { onDestroy, setContext } from "svelte";
import { PublicationTree } from "$lib/data_structures/publication_tree";
+ import { page } from "$app/stores";
- let { data }: { data: PageData } = $props();
+ // Extend the PageData type with the properties we need
+ interface ExtendedPageData extends PageData {
+ waitable: Promise;
+ publicationType: string;
+ indexEvent: NDKEvent;
+ parser: any;
+ }
const publicationTree = new PublicationTree(data.publicationRootEvent, data.ndk);
setContext('publicationTree', publicationTree);
+ let { data } = $props<{ data: ExtendedPageData }>();
+
+ // Get publication metadata for OpenGraph tags
+ let title = $derived(data.indexEvent?.getMatchingTags('title')[0]?.[1] || data.parser?.getIndexTitle(data.parser?.getRootIndexId()) || 'Alexandria Publication');
+ let currentUrl = $page.url.href;
+
+ // Get image and summary from the event tags if available
+ // If image unavailable, use the Alexandria default pic.
+ let image = $derived(data.indexEvent?.getMatchingTags('image')[0]?.[1] || '/screenshots/old_books.jpg');
+ let summary = $derived(data.indexEvent?.getMatchingTags('summary')[0]?.[1] || 'Alexandria is a digital library, utilizing Nostr events for curated publications and wiki pages.');
+
onDestroy(() => data.parser.reset());
+
+
+ {title}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{#await data.waitable}
{:then}
-
+
{/await}
diff --git a/src/routes/publication/+page.ts b/src/routes/publication/+page.ts
index 72116ec..56b7fd1 100644
--- a/src/routes/publication/+page.ts
+++ b/src/routes/publication/+page.ts
@@ -1,6 +1,6 @@
import { error } from '@sveltejs/kit';
+import type { Load } from '@sveltejs/kit';
import type { NDKEvent } from '@nostr-dev-kit/ndk';
-import type { PageLoad } from './$types';
import { nip19 } from 'nostr-tools';
import { getActiveRelays } from '$lib/ndk.ts';
@@ -82,7 +82,7 @@ async function fetchEventByDTag(ndk: any, dTag: string): Promise {
}
}
-export const load: PageLoad = async ({ url, parent }: { url: URL; parent: () => Promise }) => {
+export const load: Load = async ({ url, parent }: { url: URL; parent: () => Promise }) => {
const id = url.searchParams.get('id');
const dTag = url.searchParams.get('d');
const { ndk, parser } = await parent();
@@ -102,6 +102,6 @@ export const load: PageLoad = async ({ url, parent }: { url: URL; parent: () =>
return {
waitable: fetchPromise,
publicationType,
- publicationRootEvent: indexEvent,
+ indexEvent,
};
};
diff --git a/src/routes/visualize/+page.svelte b/src/routes/visualize/+page.svelte
index 35b837d..f1f7d33 100644
--- a/src/routes/visualize/+page.svelte
+++ b/src/routes/visualize/+page.svelte
@@ -49,7 +49,7 @@
// Fetch the referenced content events
const contentEvents = await $ndkInstance.fetchEvents(
{
- kinds: [30041],
+ kinds: [30041, 30818],
ids: Array.from(contentEventIds),
},
{
@@ -79,44 +79,45 @@