+
+
{JSON.stringify(event.rawEvent(), null, 2)}
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index 0045d4c..4cac70e 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -2,15 +2,44 @@
import "../app.css";
import Navigation from "$lib/components/Navigation.svelte";
import { onMount } from "svelte";
+ import { page } from "$app/stores";
// Compute viewport height.
$: displayHeight = window.innerHeight;
+ // Get standard metadata for OpenGraph tags
+ let title = 'Library of Alexandria';
+ let currentUrl = $page.url.href;
+
+ // Get default image and summary for the Alexandria website
+ let image = '/screenshots/old_books.jpg';
+ let summary = 'Alexandria is a digital library, utilizing Nostr events for curated publications and wiki pages.';
+
onMount(() => {
document.body.style.height = `${displayHeight}px`;
});
+
+
+ {title}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/routes/about/+page.svelte b/src/routes/about/+page.svelte
index 9a2f461..2eb3076 100644
--- a/src/routes/about/+page.svelte
+++ b/src/routes/about/+page.svelte
@@ -4,8 +4,9 @@
- About
-
+ About the Library of Alexandria
+
+
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.
diff --git a/src/routes/publication/+page.svelte b/src/routes/publication/+page.svelte
index dbd673f..dff8ffb 100644
--- a/src/routes/publication/+page.svelte
+++ b/src/routes/publication/+page.svelte
@@ -3,16 +3,60 @@
import { TextPlaceholder } from "flowbite-svelte";
import type { PageData } from "./$types";
import { onDestroy } from "svelte";
+ import type { NDKEvent } from "@nostr-dev-kit/ndk";
+ import { pharosInstance } from "$lib/parser";
+ 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;
+ }
+
+ 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 286063a..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,5 +102,6 @@ export const load: PageLoad = async ({ url, parent }: { url: URL; parent: () =>
return {
waitable: fetchPromise,
publicationType,
+ indexEvent,
};
};
diff --git a/static/favicon.png b/static/favicon.png
index 825b9e6..7418972 100644
Binary files a/static/favicon.png and b/static/favicon.png differ
diff --git a/static/screenshots/old_books.jpg b/static/screenshots/old_books.jpg
new file mode 100644
index 0000000..933a0be
Binary files /dev/null and b/static/screenshots/old_books.jpg differ