@levino/shipyard-docs 0.6.0 → 0.6.1-rc-20260107090031
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/astro/DocsEntry.astro +10 -1
- package/package.json +2 -2
- package/src/index.ts +10 -0
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-20260107090031",
|
|
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-20260107090031"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@tailwindcss/typography": "^0.5.16",
|
package/src/index.ts
CHANGED
|
@@ -434,7 +434,17 @@ if (customEditUrl === null) {
|
|
|
434
434
|
editUrl = undefined
|
|
435
435
|
} else if (customEditUrl) {
|
|
436
436
|
editUrl = customEditUrl
|
|
437
|
+
} else if (entry.filePath) {
|
|
438
|
+
// Use filePath instead of entry.id because Astro's glob loader
|
|
439
|
+
// strips "index" from entry.id for index pages (e.g., en/index -> en)
|
|
440
|
+
// Strip the collection base directory to get the relative path
|
|
441
|
+
const collectionBase = \`\${docsConfig.collectionName}/\`
|
|
442
|
+
const relativePath = entry.filePath.startsWith(collectionBase)
|
|
443
|
+
? entry.filePath.slice(collectionBase.length)
|
|
444
|
+
: entry.filePath
|
|
445
|
+
editUrl = getEditUrl(docsConfig.editUrl, relativePath)
|
|
437
446
|
} else {
|
|
447
|
+
// Fallback to entry.id if filePath is not available
|
|
438
448
|
editUrl = getEditUrl(docsConfig.editUrl, entry.id)
|
|
439
449
|
}
|
|
440
450
|
|