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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-svelte-docsmith",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Scaffold a documentation site powered by Svelte DocSmith.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -10,7 +10,7 @@
10
10
  "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json"
11
11
  },
12
12
  "dependencies": {
13
- "svelte-docsmith": "^0.4.0"
13
+ "svelte-docsmith": "^0.5.1"
14
14
  },
15
15
  "devDependencies": {
16
16
  "@sveltejs/adapter-auto": "^7.0.1",
@@ -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
+ };
@@ -12,6 +12,7 @@
12
12
  content={docs}
13
13
  search={() => import('svelte-docsmith/search').then((m) => m.docs)}
14
14
  pattern
15
+ copyPage
15
16
  >
16
17
  {@render children()}
17
18
  </DocsShell>
@@ -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
+ }
@@ -0,0 +1,5 @@
1
+ User-agent: *
2
+ Allow: /
3
+
4
+ # Update this to your deployed origin.
5
+ Sitemap: https://your-docs.dev/sitemap.xml