@levino/shipyard-docs 0.6.0 → 0.6.1-rc-20260108111817
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/README.md +1 -1
- package/astro/DocsEntry.astro +10 -1
- package/package.json +2 -2
- package/src/index.ts +22 -5
package/README.md
CHANGED
package/astro/DocsEntry.astro
CHANGED
|
@@ -61,8 +61,17 @@ if (custom_edit_url === null) {
|
|
|
61
61
|
} else if (custom_edit_url) {
|
|
62
62
|
// Custom URL provided
|
|
63
63
|
editUrl = custom_edit_url
|
|
64
|
+
} else if (entry.filePath) {
|
|
65
|
+
// Use filePath instead of entry.id because Astro's glob loader
|
|
66
|
+
// strips "index" from entry.id for index pages (e.g., en/index -> en)
|
|
67
|
+
// Strip the collection base directory to get the relative path
|
|
68
|
+
const collectionBase = `${docsConfig.collectionName}/`
|
|
69
|
+
const relativePath = entry.filePath.startsWith(collectionBase)
|
|
70
|
+
? entry.filePath.slice(collectionBase.length)
|
|
71
|
+
: entry.filePath
|
|
72
|
+
editUrl = getEditUrl(docsConfig.editUrl, relativePath)
|
|
64
73
|
} else {
|
|
65
|
-
//
|
|
74
|
+
// Fallback to entry.id if filePath is not available
|
|
66
75
|
editUrl = getEditUrl(docsConfig.editUrl, entry.id)
|
|
67
76
|
}
|
|
68
77
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@levino/shipyard-docs",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1-rc-20260108111817",
|
|
4
4
|
"description": "Documentation plugin for shipyard with automatic sidebar, pagination, and git metadata",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"effect": "^3.12.5",
|
|
28
28
|
"ramda": "^0.31",
|
|
29
|
-
"@levino/shipyard-base": "
|
|
29
|
+
"@levino/shipyard-base": "0.7.0-rc-20260108111817"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@tailwindcss/typography": "^0.5.16",
|
package/src/index.ts
CHANGED
|
@@ -251,6 +251,12 @@ export interface DocsConfig {
|
|
|
251
251
|
* ```
|
|
252
252
|
*/
|
|
253
253
|
llmsTxt?: LlmsTxtDocsConfig
|
|
254
|
+
/**
|
|
255
|
+
* Whether to prerender docs pages at build time.
|
|
256
|
+
* Set to false for SSR sites with auth middleware that need access to request headers/cookies.
|
|
257
|
+
* @default true
|
|
258
|
+
*/
|
|
259
|
+
prerender?: boolean
|
|
254
260
|
}
|
|
255
261
|
|
|
256
262
|
/**
|
|
@@ -327,6 +333,7 @@ export default (config: DocsConfig = {}): AstroIntegration => {
|
|
|
327
333
|
showLastUpdateTime = false,
|
|
328
334
|
showLastUpdateAuthor = false,
|
|
329
335
|
llmsTxt,
|
|
336
|
+
prerender = true,
|
|
330
337
|
} = config
|
|
331
338
|
|
|
332
339
|
// Normalize the route base path (remove leading/trailing slashes safely)
|
|
@@ -434,7 +441,17 @@ if (customEditUrl === null) {
|
|
|
434
441
|
editUrl = undefined
|
|
435
442
|
} else if (customEditUrl) {
|
|
436
443
|
editUrl = customEditUrl
|
|
444
|
+
} else if (entry.filePath) {
|
|
445
|
+
// Use filePath instead of entry.id because Astro's glob loader
|
|
446
|
+
// strips "index" from entry.id for index pages (e.g., en/index -> en)
|
|
447
|
+
// Strip the collection base directory to get the relative path
|
|
448
|
+
const collectionBase = \`\${docsConfig.collectionName}/\`
|
|
449
|
+
const relativePath = entry.filePath.startsWith(collectionBase)
|
|
450
|
+
? entry.filePath.slice(collectionBase.length)
|
|
451
|
+
: entry.filePath
|
|
452
|
+
editUrl = getEditUrl(docsConfig.editUrl, relativePath)
|
|
437
453
|
} else {
|
|
454
|
+
// Fallback to entry.id if filePath is not available
|
|
438
455
|
editUrl = getEditUrl(docsConfig.editUrl, entry.id)
|
|
439
456
|
}
|
|
440
457
|
|
|
@@ -506,14 +523,14 @@ if (
|
|
|
506
523
|
injectRoute({
|
|
507
524
|
pattern: `/[locale]/${normalizedBasePath}/[...slug]`,
|
|
508
525
|
entrypoint: entryFilePath,
|
|
509
|
-
prerender
|
|
526
|
+
prerender,
|
|
510
527
|
})
|
|
511
528
|
} else {
|
|
512
529
|
// Without i18n: direct path
|
|
513
530
|
injectRoute({
|
|
514
531
|
pattern: `/${normalizedBasePath}/[...slug]`,
|
|
515
532
|
entrypoint: entryFilePath,
|
|
516
|
-
prerender
|
|
533
|
+
prerender,
|
|
517
534
|
})
|
|
518
535
|
}
|
|
519
536
|
|
|
@@ -737,20 +754,20 @@ export const GET: APIRoute = async ({ site }) => {
|
|
|
737
754
|
injectRoute({
|
|
738
755
|
pattern: `/${normalizedBasePath}/_llms-txt/[...slug].txt`,
|
|
739
756
|
entrypoint: llmsTxtPagesFilePath,
|
|
740
|
-
prerender
|
|
757
|
+
prerender,
|
|
741
758
|
})
|
|
742
759
|
|
|
743
760
|
// Inject routes for llms.txt and llms-full.txt under the docs path
|
|
744
761
|
injectRoute({
|
|
745
762
|
pattern: `/${normalizedBasePath}/llms.txt`,
|
|
746
763
|
entrypoint: llmsTxtFilePath,
|
|
747
|
-
prerender
|
|
764
|
+
prerender,
|
|
748
765
|
})
|
|
749
766
|
|
|
750
767
|
injectRoute({
|
|
751
768
|
pattern: `/${normalizedBasePath}/llms-full.txt`,
|
|
752
769
|
entrypoint: llmsFullTxtFilePath,
|
|
753
|
-
prerender
|
|
770
|
+
prerender,
|
|
754
771
|
})
|
|
755
772
|
}
|
|
756
773
|
},
|