diff --git a/tools/add_lego.js b/tools/add_lego.js index dce4df11..2ef1d36c 100644 --- a/tools/add_lego.js +++ b/tools/add_lego.js @@ -309,7 +309,7 @@ async function main() { const nameNoExt = base.replace(/\.[^.]+$/, ''); const yamlPath = path.join(dataImagesDir, `${nameNoExt}.yaml`); const titleForSetImage = (setDetails.name || selected.name || '').replace(/"/g, '\\"'); - const yaml = `attribution: "© Rebrickable"\n` + + const yaml = `attribution: "© [Rebrickable](https://rebrickable.com/)"\n` + `title: "${titleForSetImage}"\n`; await fs.writeFile(yamlPath, yaml, 'utf8'); } @@ -356,8 +356,12 @@ async function main() { const nameNoExt = base.replace(/\.[^.]+$/, ''); const yamlPath = path.join(dataImagesDir, `${nameNoExt}.yaml`); - const yaml = `attribution: "© Rebrickable"\n` + - `title: "${(figTitle || '').replace(/"/g, '\\"')}"\n`; + const cleanedTitle = (figTitle || '').trim(); + const yamlLines = [`attribution: "© Rebrickable"`]; + if (cleanedTitle) { + yamlLines.push(`title: "${cleanedTitle.replace(/"/g, '\\"')}"`); + } + const yaml = `${yamlLines.join('\n')}\n`; await fs.writeFile(yamlPath, yaml, 'utf8'); } }