tangled
alpha
login
or
join now
leaflet.pub
/
leaflet
289
fork
atom
a tool for shared writing and social publishing
289
fork
atom
overview
issues
28
pulls
pipelines
add titles to tags and profiles
awarm.space
3 months ago
625e507c
8f8e0003
+41
2 changed files
expand all
collapse all
unified
split
app
(home-pages)
p
[didOrHandle]
layout.tsx
tag
[tag]
page.tsx
+32
app/(home-pages)/p/[didOrHandle]/layout.tsx
···
8
8
import { ProfileLayout } from "./ProfileLayout";
9
9
import { Agent } from "@atproto/api";
10
10
import { get_profile_data } from "app/api/rpc/[command]/get_profile_data";
11
11
+
import { Metadata } from "next";
12
12
+
13
13
+
export async function generateMetadata(props: {
14
14
+
params: Promise<{ didOrHandle: string }>;
15
15
+
}): Promise<Metadata> {
16
16
+
let params = await props.params;
17
17
+
let didOrHandle = decodeURIComponent(params.didOrHandle);
18
18
+
19
19
+
let did = didOrHandle;
20
20
+
if (!didOrHandle.startsWith("did:")) {
21
21
+
let resolved = await idResolver.handle.resolve(didOrHandle);
22
22
+
if (!resolved) return { title: "Profile - Leaflet" };
23
23
+
did = resolved;
24
24
+
}
25
25
+
26
26
+
let profileData = await get_profile_data.handler(
27
27
+
{ didOrHandle: did },
28
28
+
{ supabase: supabaseServerClient },
29
29
+
);
30
30
+
let { profile } = profileData.result;
31
31
+
32
32
+
if (!profile) return { title: "Profile - Leaflet" };
33
33
+
34
34
+
const displayName = profile.displayName;
35
35
+
const handle = profile.handle;
36
36
+
37
37
+
const title = displayName
38
38
+
? `${displayName} (@${handle}) - Leaflet`
39
39
+
: `@${handle} - Leaflet`;
40
40
+
41
41
+
return { title };
42
42
+
}
11
43
12
44
export default async function ProfilePageLayout(props: {
13
45
params: Promise<{ didOrHandle: string }>;
+9
app/(home-pages)/tag/[tag]/page.tsx
···
3
3
import { PostListing } from "components/PostListing";
4
4
import { getDocumentsByTag } from "./getDocumentsByTag";
5
5
import { TagTiny } from "components/Icons/TagTiny";
6
6
+
import { Metadata } from "next";
7
7
+
8
8
+
export async function generateMetadata(props: {
9
9
+
params: Promise<{ tag: string }>;
10
10
+
}): Promise<Metadata> {
11
11
+
const params = await props.params;
12
12
+
const decodedTag = decodeURIComponent(params.tag);
13
13
+
return { title: `${decodedTag} - Leaflet` };
14
14
+
}
6
15
7
16
export default async function TagPage(props: {
8
17
params: Promise<{ tag: string }>;