Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions patches/@signalwire__docusaurus-plugin-llms-txt@1.2.2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
diff --git a/lib/utils/url.js b/lib/utils/url.js
index 0c3168c9128b6abd1a0860b222872b2332dc5ab8..303ac39b92e24c9008924c949ecf91c6746c38cc 100644
--- a/lib/utils/url.js
+++ b/lib/utils/url.js
@@ -56,19 +56,31 @@ export function stripBaseUrl(routePath, baseUrl) {
*/
export function formatUrl(routePath, options, baseUrl = '') {
const { enableMarkdownFiles = true, relativePaths = true, markdownFile, } = options;
+ // routePath and markdownFile may already carry the Docusaurus baseUrl. Strip it, or the
+ // section prefix lands in the URL twice. Stripping before the .md suffix is what keeps a
+ // route that is the site root on the INDEX_MD branch instead of producing '/.md'.
+ const sitePath = relativePaths === false && baseUrl
+ ? (baseUrl.replace(/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i, '') || '/')
+ : null;
// Ensure route path starts with /
let targetPath = ensureLeadingSlash(routePath);
+ if (sitePath) {
+ targetPath = stripBaseUrl(targetPath, sitePath);
+ }
// Use markdown file path if available and enabled
if (enableMarkdownFiles && markdownFile) {
// Ensure markdown file path starts with / for consistency
targetPath = ensureLeadingSlash(markdownFile);
+ if (sitePath) {
+ targetPath = stripBaseUrl(targetPath, sitePath);
+ }
}
else if (enableMarkdownFiles) {
// Add .md extension to route path
targetPath = targetPath === '/' ? INDEX_MD : `${targetPath}.md`;
}
// Handle absolute vs relative paths
- if (relativePaths === false && baseUrl) {
+ if (sitePath) {
return normalizeUrl([baseUrl, targetPath]);
}
// For relative paths, ensure we preserve the leading slash
Loading
Loading