MCPcopy
hub / github.com/facebook/docusaurus / getDocEditUrl

Function getDocEditUrl

packages/docusaurus-plugin-content-docs/src/docs.ts:187–211  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

185 const permalink = normalizeUrl([versionMetadata.path, docSlug]);
186
187 function getDocEditUrl() {
188 const relativeFilePath = path.relative(contentPath, filePath);
189
190 if (typeof options.editUrl === 'function') {
191 return options.editUrl({
192 version: versionMetadata.versionName,
193 versionDocsDirPath: posixPath(
194 path.relative(siteDir, versionMetadata.contentPath),
195 ),
196 docPath: posixPath(relativeFilePath),
197 permalink,
198 locale: context.i18n.currentLocale,
199 });
200 } else if (typeof options.editUrl === 'string') {
201 const isLocalized =
202 typeof versionMetadata.contentPathLocalized !== 'undefined' &&
203 contentPath === versionMetadata.contentPathLocalized;
204 const baseVersionEditUrl =
205 isLocalized && options.editLocalizedFiles
206 ? versionMetadata.editUrlLocalized
207 : versionMetadata.editUrl;
208 return getEditUrl(relativeFilePath, baseVersionEditUrl);
209 }
210 return undefined;
211 }
212
213 const draft = isDraft({env, frontMatter});
214 const unlisted = isUnlisted({env, frontMatter});

Callers 1

doProcessDocMetadataFunction · 0.85

Calls 2

posixPathFunction · 0.90
getEditUrlFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…