a Linkat frontend.

feat(meta): define who is the directory owner in the metadata

+44 -9
+44 -9
src/routes/user/[did]/+page.svelte
··· 2 2 import DynamicLinks from "$lib/components/layout/main/DynamicLinks.svelte"; 3 3 import DynamicHead from "$lib/components/layout/DynamicHead.svelte"; 4 4 import { getStores } from "$app/stores"; 5 + import { env } from "$env/dynamic/public"; 6 + import { getProfile } from "$components/profile/profile"; 7 + 5 8 const { page } = getStores(); 6 - 7 9 let { data } = $props(); 8 - 10 + 9 11 let profile = $derived(data.profile); 10 12 let dynamicLinks = $derived(data.dynamicLinks); 11 13 let error = $derived(data.error); 12 14 let did = $derived(data.did); 15 + 16 + let directoryOwner = env.DIRECTORY_OWNER; 17 + let ownerProfile = $state<{ displayName?: string; handle?: string } | null>(null); 18 + 19 + $effect(() => { 20 + if (directoryOwner) { 21 + const loadOwner = async () => { 22 + try { 23 + const result = await getProfile(fetch); 24 + ownerProfile = result; 25 + } catch (err) { 26 + console.error("Could not fetch owner profile:", err); 27 + ownerProfile = null; 28 + } 29 + }; 30 + loadOwner(); 31 + } 32 + }); 33 + 34 + const getDisplayName = (p: { displayName?: string; handle?: string } | null | undefined) => 35 + p?.displayName || p?.handle || null; 13 36 </script> 14 37 15 38 <DynamicHead 16 - title={profile?.displayName || did + " - Linkat Directory"} 17 - description={"View " + (profile?.displayName || did) + "'s curated Linkat links"} 18 - ogTitle={profile?.displayName || did + " - Linkat Directory"} 19 - ogDescription={"View " + (profile?.displayName || did) + "'s curated Linkat links"} 20 - twitterTitle={profile?.displayName || did + " - Linkat Directory"} 21 - twitterDescription={"View " + (profile?.displayName || did) + "'s curated Linkat links"} 22 - keywords={`Linkat, directory, links, Bluesky, curation, ${profile?.displayName || did}`} 39 + title={ 40 + directoryOwner 41 + ? `${getDisplayName(profile) || did} – ${getDisplayName(ownerProfile) || directoryOwner}'s Linkat Directory` 42 + : `${getDisplayName(profile) || did} – Linkat Directory` 43 + } 44 + description={`View ${getDisplayName(profile) || did}'s curated links in ${directoryOwner ? getDisplayName(ownerProfile) || directoryOwner + "'s" : "the"} Linkat Directory`} 45 + ogTitle={ 46 + directoryOwner 47 + ? `${getDisplayName(profile) || did} – ${getDisplayName(ownerProfile) || directoryOwner}'s Linkat Directory` 48 + : `${getDisplayName(profile) || did} – Linkat Directory` 49 + } 50 + ogDescription={`View ${getDisplayName(profile) || did}'s curated links in ${directoryOwner ? getDisplayName(ownerProfile) || directoryOwner + "'s" : "the"} Linkat Directory`} 51 + twitterTitle={ 52 + directoryOwner 53 + ? `${getDisplayName(profile) || did} – ${getDisplayName(ownerProfile) || directoryOwner}'s Linkat Directory` 54 + : `${getDisplayName(profile) || did} – Linkat Directory` 55 + } 56 + twitterDescription={`View ${getDisplayName(profile) || did}'s curated links in ${directoryOwner ? getDisplayName(ownerProfile) || directoryOwner + "'s" : "the"} Linkat Directory`} 57 + keywords={`Linkat, directory, links, Bluesky, curation, ${getDisplayName(profile) || did}, ${getDisplayName(ownerProfile) || directoryOwner}`} 23 58 /> 24 59 25 60 <div class="container mx-auto px-4 py-8">