diff --git a/.changeset/mighty-geckos-kiss.md b/.changeset/mighty-geckos-kiss.md new file mode 100644 index 0000000000..0761d8b257 --- /dev/null +++ b/.changeset/mighty-geckos-kiss.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-techdocs-node': patch +--- + +Update `patchMkdocsYmlPrebuild` to modify `repo_url` and `edit_uri` independently. diff --git a/plugins/techdocs-node/src/stages/generate/mkdocsPatchers.ts b/plugins/techdocs-node/src/stages/generate/mkdocsPatchers.ts index 762a1c267a..fb95c19a9c 100644 --- a/plugins/techdocs-node/src/stages/generate/mkdocsPatchers.ts +++ b/plugins/techdocs-node/src/stages/generate/mkdocsPatchers.ts @@ -108,7 +108,7 @@ export const patchMkdocsYmlPreBuild = async ( scmIntegrations: ScmIntegrationRegistry, ) => { await patchMkdocsFile(mkdocsYmlPath, logger, mkdocsYml => { - if (!('repo_url' in mkdocsYml) && !('edit_uri' in mkdocsYml)) { + if (!('repo_url' in mkdocsYml) || !('edit_uri' in mkdocsYml)) { // Add edit_uri and/or repo_url to mkdocs.yml if it is missing. // This will enable the Page edit button generated by MkDocs. // If the either has been set, keep the original value @@ -119,8 +119,8 @@ export const patchMkdocsYmlPreBuild = async ( ); if (result.repo_url || result.edit_uri) { - mkdocsYml.repo_url = result.repo_url; - mkdocsYml.edit_uri = result.edit_uri; + mkdocsYml.repo_url = mkdocsYml.repo_url || result.repo_url; + mkdocsYml.edit_uri = mkdocsYml.edit_uri || result.edit_uri; logger.info( `Set ${JSON.stringify(