MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / buildThreadSeo

Function buildThreadSeo

apps/web/utilities/seo/buildThreadSeo.tsx:6–41  ·  view source on GitHub ↗
({
  isSubDomainRouting,
  channelName,
  settings,
  thread,
}: {
  isSubDomainRouting: boolean;
  channelName: string;
  settings: Settings;
  thread: SerializedThread;
})

Source from the content-addressed store, hash-verified

4import { replaceMentions } from './utils/replaceMentions';
5
6export function buildThreadSeo({
7 isSubDomainRouting,
8 channelName,
9 settings,
10 thread,
11}: {
12 isSubDomainRouting: boolean;
13 channelName: string;
14 settings: Settings;
15 thread: SerializedThread;
16}) {
17 const firstMessage = thread.messages.find(Boolean);
18 const cleanBody = normalize(
19 replaceMentions({
20 body: firstMessage?.body || thread.slug,
21 mentions: firstMessage?.mentions || [],
22 })
23 );
24 const title = [
25 thread.title || cleanBody.slice(0, 60),
26 settings.communityName,
27 '#' + channelName,
28 ]
29 .filter(Boolean)
30 .join(' ');
31
32 const url = buildUrl(isSubDomainRouting, settings, thread);
33
34 return {
35 title,
36 description: cleanBody.slice(0, 200),
37 image: settings.logoUrl,
38 url,
39 robotsMetaTag: thread.robotsMetaTag,
40 };
41}

Callers 4

ThreadPageFunction · 0.90
getServerSidePropsFunction · 0.90
getServerSidePropsFunction · 0.90

Calls 4

normalizeFunction · 0.90
replaceMentionsFunction · 0.90
buildUrlFunction · 0.90
findMethod · 0.45

Tested by

no test coverage detected