create-svelte-docsmith 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/package.json +1 -1
- package/template/src/lib/site-config.ts +4 -0
- package/template/src/routes/[...slug].md/+server.ts +17 -0
- package/template/src/routes/docs/+layout.svelte +1 -0
- package/template/src/routes/llms-full.txt/+server.ts +13 -0
- package/template/src/routes/llms.txt/+server.ts +13 -0
- package/template/src/routes/sitemap.xml/+server.ts +13 -0
- package/template/static/robots.txt +5 -0
package/package.json
CHANGED
package/template/package.json
CHANGED
|
@@ -6,7 +6,11 @@ export const siteConfig: DocsmithConfig = {
|
|
|
6
6
|
title: '{{SITE_TITLE}}',
|
|
7
7
|
// github: 'https://github.com/you/your-library',
|
|
8
8
|
// description: 'A short tagline, used as the default meta description.',
|
|
9
|
+
// Set `url` to your deployed origin so the sitemap, llms.txt, and social
|
|
10
|
+
// tags emit absolute links.
|
|
9
11
|
// url: 'https://your-docs.dev',
|
|
12
|
+
// Base URL for the "Edit this page" link (points at your repo's docs dir).
|
|
13
|
+
// editUrl: 'https://github.com/you/your-library/edit/main',
|
|
10
14
|
nav: [{ label: 'Docs', href: '/docs/introduction' }],
|
|
11
15
|
footer: {
|
|
12
16
|
copyright: `© ${new Date().getFullYear()} {{SITE_TITLE}}`
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { docs } from 'svelte-docsmith/llms';
|
|
2
|
+
import { error } from '@sveltejs/kit';
|
|
3
|
+
import type { EntryGenerator, RequestHandler } from './$types';
|
|
4
|
+
|
|
5
|
+
export const prerender = true;
|
|
6
|
+
|
|
7
|
+
// Enumerate every page so the `.md` twins prerender even if nothing links to them.
|
|
8
|
+
export const entries: EntryGenerator = () =>
|
|
9
|
+
docs.map((doc) => ({ slug: doc.path.replace(/^\//, '') }));
|
|
10
|
+
|
|
11
|
+
export const GET: RequestHandler = ({ params }) => {
|
|
12
|
+
const doc = docs.find((d) => d.path === `/${params.slug}`);
|
|
13
|
+
if (!doc) error(404, 'Not found');
|
|
14
|
+
return new Response(doc.content, {
|
|
15
|
+
headers: { 'content-type': 'text/markdown; charset=utf-8' }
|
|
16
|
+
});
|
|
17
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { docs } from 'svelte-docsmith/llms';
|
|
2
|
+
import { generateLlmsFullTxt } from 'svelte-docsmith';
|
|
3
|
+
import { siteConfig } from '$lib/site-config';
|
|
4
|
+
|
|
5
|
+
export const prerender = true;
|
|
6
|
+
|
|
7
|
+
export function GET() {
|
|
8
|
+
const body = generateLlmsFullTxt(
|
|
9
|
+
{ title: siteConfig.title, description: siteConfig.description, origin: siteConfig.url },
|
|
10
|
+
docs
|
|
11
|
+
);
|
|
12
|
+
return new Response(body, { headers: { 'content-type': 'text/plain; charset=utf-8' } });
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { docs } from 'svelte-docsmith/llms';
|
|
2
|
+
import { generateLlmsTxt } from 'svelte-docsmith';
|
|
3
|
+
import { siteConfig } from '$lib/site-config';
|
|
4
|
+
|
|
5
|
+
export const prerender = true;
|
|
6
|
+
|
|
7
|
+
export function GET() {
|
|
8
|
+
const body = generateLlmsTxt(
|
|
9
|
+
{ title: siteConfig.title, description: siteConfig.description, origin: siteConfig.url },
|
|
10
|
+
docs
|
|
11
|
+
);
|
|
12
|
+
return new Response(body, { headers: { 'content-type': 'text/plain; charset=utf-8' } });
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { docs } from 'svelte-docsmith/content';
|
|
2
|
+
import { generateSitemap } from 'svelte-docsmith';
|
|
3
|
+
import { siteConfig } from '$lib/site-config';
|
|
4
|
+
|
|
5
|
+
export const prerender = true;
|
|
6
|
+
|
|
7
|
+
export function GET() {
|
|
8
|
+
const body = generateSitemap(siteConfig.url ?? '', [
|
|
9
|
+
{ path: '/' },
|
|
10
|
+
...docs.map((d) => ({ path: d.path, lastmod: d.lastUpdated }))
|
|
11
|
+
]);
|
|
12
|
+
return new Response(body, { headers: { 'content-type': 'application/xml' } });
|
|
13
|
+
}
|