generated from polymech/site-template
llms.txt 1/2
This commit is contained in:
@@ -427,16 +427,29 @@ export function loader(): Loader {
|
||||
item
|
||||
}
|
||||
|
||||
let storeItem = {
|
||||
const storeItem = {
|
||||
digest: await generateDigest(data),
|
||||
filePath: id,
|
||||
id: `${item.slug}`,
|
||||
data: data
|
||||
}
|
||||
|
||||
storeItem = await onStoreItem(storeItem)
|
||||
storeItem.data['config'] = JSON.stringify(storeItem.data, null, 2)
|
||||
store.set(storeItem)
|
||||
const storeItemProcessed = await onStoreItem(storeItem)
|
||||
|
||||
// Emit to LLM Registry
|
||||
try {
|
||||
const { LLMRegistry } = await import('@polymech/astro-base/registry')
|
||||
LLMRegistry.add("How-To Guides", {
|
||||
title: data.title,
|
||||
url: `/howtos/${data.slug}`,
|
||||
description: storeItemProcessed.data.item.description || ""
|
||||
})
|
||||
} catch (e) {
|
||||
console.error("Failed to emit to LLM Registry", e)
|
||||
}
|
||||
|
||||
storeItemProcessed.data['config'] = JSON.stringify(storeItemProcessed.data, null, 2)
|
||||
store.set(storeItemProcessed)
|
||||
}
|
||||
}
|
||||
return {
|
||||
|
||||
@@ -1,115 +1,3 @@
|
||||
---
|
||||
import BaseLayout from "../layouts/BaseLayout.astro";
|
||||
Astro.redirect("/en/home");
|
||||
---
|
||||
|
||||
<BaseLayout>
|
||||
<section>
|
||||
<div
|
||||
class="flex flex-col gap-12 h-full justify-between p-4 text-center py-20"
|
||||
>
|
||||
<div class="max-w-xl mx-auto">
|
||||
<h1
|
||||
class="text-lg text-neutral-600 font-mono tracking-tight text-balance"
|
||||
>
|
||||
404 Page not found
|
||||
</h1>
|
||||
<p class="text-sm text-balance text-neutral-500">
|
||||
The page you are looking for does not exist. Please try again. If the
|
||||
problem persists, please contact us.
|
||||
</p>
|
||||
<div class="gap-2 flex flex-col h-full justify-end mt-12">
|
||||
<a
|
||||
href="/"
|
||||
title="link to your page"
|
||||
aria-label="your label"
|
||||
class="relative group overflow-hidden pl-4 font-mono h-14 flex space-x-6 items-center bg-white hover:bg-neutral-200 duration-300 rounded-xl w-full justify-between"
|
||||
>
|
||||
<span class="relative uppercase text-xs text-orange-600"
|
||||
>Go home</span
|
||||
>
|
||||
<div
|
||||
aria-hidden="true"
|
||||
class="w-12 text-orange-600 transition duration-300 -translate-y-7 group-hover:translate-y-7"
|
||||
>
|
||||
<div class="h-14 flex">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke-width="1.5"
|
||||
stroke="currentColor"
|
||||
class="size-6 m-auto fill-white"
|
||||
>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
d="M17.25 8.25 21 12m0 0-3.75 3.75M21 12H3"></path>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="h-14 flex">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke-width="1.5"
|
||||
stroke="currentColor"
|
||||
class="size-6 m-auto fill-white"
|
||||
>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
d="M17.25 8.25 21 12m0 0-3.75 3.75M21 12H3"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<a
|
||||
href="/forms/contact"
|
||||
title="link to your page"
|
||||
aria-label="your label"
|
||||
class="relative group overflow-hidden pl-4 font-mono h-14 flex space-x-6 items-center bg-orange-500 hover:bg-black duration-300 rounded-xl w-full justify-between"
|
||||
>
|
||||
<span class="relative uppercase text-xs text-white">Contact us</span
|
||||
>
|
||||
<div
|
||||
aria-hidden="true"
|
||||
class="w-12 text-white transition duration-300 -translate-y-7 group-hover:translate-y-7"
|
||||
>
|
||||
<div class="h-14 flex">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke-width="1.5"
|
||||
stroke="currentColor"
|
||||
class="size-6 m-auto fill-white"
|
||||
>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
d="M17.25 8.25 21 12m0 0-3.75 3.75M21 12H3"></path>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="h-14 flex">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke-width="1.5"
|
||||
stroke="currentColor"
|
||||
class="size-6 m-auto fill-white"
|
||||
>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
d="M17.25 8.25 21 12m0 0-3.75 3.75M21 12H3"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</BaseLayout>
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
import { getCollection } from 'astro:content';
|
||||
|
||||
export const GET = async ({ params, props }) => {
|
||||
const { item } = props;
|
||||
|
||||
if (!item) {
|
||||
return new Response('Not found', { status: 404 });
|
||||
}
|
||||
|
||||
const content = `
|
||||
# ${item.data.title}
|
||||
|
||||
${item.data.description}
|
||||
|
||||
[View Original](${import.meta.env.SITE || ''}/${params.locale}/howtos/${item.slug})
|
||||
|
||||
---
|
||||
|
||||
${item.data.item.content || 'Content not available in markdown format.'}
|
||||
`.trim();
|
||||
|
||||
return new Response(content, {
|
||||
headers: { 'Content-Type': 'text/plain; charset=utf-8' },
|
||||
});
|
||||
};
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const howtos = await getCollection('howtos');
|
||||
const locales = ['en'];
|
||||
|
||||
return locales.flatMap(locale =>
|
||||
howtos.map(item => ({
|
||||
params: {
|
||||
locale,
|
||||
path: item.slug
|
||||
},
|
||||
props: { item },
|
||||
}))
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import { getCollection } from 'astro:content';
|
||||
|
||||
export const GET = async ({ params, props }) => {
|
||||
const { item } = props;
|
||||
|
||||
if (!item) {
|
||||
return new Response('Not found', { status: 404 });
|
||||
}
|
||||
|
||||
const content = `
|
||||
# ${item.data.title}
|
||||
|
||||
${item.data.description || ''}
|
||||
|
||||
[View Original](${import.meta.env.SITE || ''}/${params.locale}/library/${item.id})
|
||||
|
||||
---
|
||||
|
||||
${item.data.readme || item.data.content || 'Content not available in markdown format.'}
|
||||
`.trim();
|
||||
|
||||
return new Response(content, {
|
||||
headers: { 'Content-Type': 'text/plain; charset=utf-8' },
|
||||
});
|
||||
};
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const products = await getCollection('store');
|
||||
const locales = ['en'];
|
||||
|
||||
return locales.flatMap(locale =>
|
||||
products.map(item => ({
|
||||
params: {
|
||||
locale,
|
||||
path: item.id
|
||||
},
|
||||
props: { item },
|
||||
}))
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { LLMRegistry } from '@polymech/astro-base/registry';
|
||||
|
||||
export const GET = async () => {
|
||||
const registry = LLMRegistry.getAll();
|
||||
let content = "# Polymech Documentation Index\n\n";
|
||||
|
||||
// Sort sections for deterministic output
|
||||
const sections = Array.from(registry.keys()).sort();
|
||||
|
||||
for (const section of sections) {
|
||||
content += `## ${section}\n\n`;
|
||||
const items = registry.get(section) || [];
|
||||
// Sort items by title for deterministic output
|
||||
items.sort((a, b) => a.title.localeCompare(b.title));
|
||||
|
||||
for (const item of items) {
|
||||
content += `- [${item.title}](${item.url}): ${item.description}\n`;
|
||||
}
|
||||
content += "\n";
|
||||
}
|
||||
|
||||
return new Response(content.trim(), {
|
||||
headers: { 'Content-Type': 'text/plain; charset=utf-8' },
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user