mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
feat(web): llms.txt, convex live stats, switch to vercel and improved ui (#460)
This commit is contained in:
26
apps/web/src/lib/get-llm-text.ts
Normal file
26
apps/web/src/lib/get-llm-text.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import type { InferPageType } from "fumadocs-core/source";
|
||||
import { remarkInclude } from "fumadocs-mdx/config";
|
||||
import { remark } from "remark";
|
||||
import remarkGfm from "remark-gfm";
|
||||
import remarkMdx from "remark-mdx";
|
||||
import type { source } from "@/lib/source";
|
||||
|
||||
const processor = remark()
|
||||
.use(remarkMdx)
|
||||
// needed for Fumadocs MDX
|
||||
.use(remarkInclude)
|
||||
.use(remarkGfm);
|
||||
|
||||
export async function getLLMText(page: InferPageType<typeof source>) {
|
||||
const processed = await processor.process({
|
||||
path: page.data._file.absolutePath,
|
||||
value: page.data.content,
|
||||
});
|
||||
|
||||
return `# ${page.data.title}
|
||||
URL: ${page.url}
|
||||
|
||||
${page.data.description}
|
||||
|
||||
${processed.value}`;
|
||||
}
|
||||
66
apps/web/src/lib/search-config.ts
Normal file
66
apps/web/src/lib/search-config.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
export interface CustomSearchItem {
|
||||
title: string;
|
||||
url: string;
|
||||
content: string;
|
||||
tags: string[];
|
||||
}
|
||||
|
||||
export const customSearchItems: CustomSearchItem[] = [
|
||||
{
|
||||
title: "Analytics",
|
||||
url: "/analytics",
|
||||
content: "Analytics",
|
||||
tags: ["analytics", "insights", "statistics", "data", "metrics"],
|
||||
},
|
||||
{
|
||||
title: "Showcase",
|
||||
url: "/showcase",
|
||||
content: "Showcase",
|
||||
tags: ["showcase", "projects", "examples", "demos", "portfolio"],
|
||||
},
|
||||
{
|
||||
title: "Builder",
|
||||
url: "/new",
|
||||
content: "Builder",
|
||||
tags: ["builder", "create", "new", "project", "setup"],
|
||||
},
|
||||
{
|
||||
title: "GitHub Repository",
|
||||
url: "https://github.com/AmanVarshney01/create-better-t-stack",
|
||||
content: "GitHub",
|
||||
tags: ["github", "source", "code", "repository", "contribute", "star"],
|
||||
},
|
||||
{
|
||||
title: "NPM Package",
|
||||
url: "https://www.npmjs.com/package/create-better-t-stack",
|
||||
content: "NPM",
|
||||
tags: ["npm", "package", "install", "cli", "tool"],
|
||||
},
|
||||
{
|
||||
title: "X (Twitter)",
|
||||
url: "https://x.com/amanvarshney01",
|
||||
content: "X",
|
||||
tags: ["twitter", "x", "social", "updates", "announcements", "follow"],
|
||||
},
|
||||
{
|
||||
title: "Discord Community",
|
||||
url: "https://discord.gg/ZYsbjpDaM5",
|
||||
content: "Discord",
|
||||
tags: ["discord", "community", "chat", "help", "support", "discussions"],
|
||||
},
|
||||
];
|
||||
|
||||
export function filterCustomItems(
|
||||
items: CustomSearchItem[],
|
||||
searchQuery: string,
|
||||
): CustomSearchItem[] {
|
||||
if (!searchQuery) return items;
|
||||
|
||||
const searchLower = searchQuery.toLowerCase();
|
||||
return items.filter(
|
||||
(item) =>
|
||||
item.title.toLowerCase().includes(searchLower) ||
|
||||
item.content.toLowerCase().includes(searchLower) ||
|
||||
item.tags.some((tag) => tag.toLowerCase().includes(searchLower)),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user