diff --git a/src/Plugins/IdAttributePlugin.js b/src/Plugins/IdAttributePlugin.js index 3fe743805..63f1bf600 100644 --- a/src/Plugins/IdAttributePlugin.js +++ b/src/Plugins/IdAttributePlugin.js @@ -65,10 +65,11 @@ function IdAttributePlugin(eleventyConfig, options = {}) { } else if (options.checkDuplicates === "error") { // Existing `id` conflicts with assigned heading id, throw error throw new Error( - "Duplicate `id` attribute (" + + 'You have more than one HTML `id` attribute using the same value (id="' + id + - ") in markup on " + - pluginOptions.page.inputPath, + '") in your template (' + + pluginOptions.page.inputPath + + "). You can disable this error in the IdAttribute plugin with the `checkDuplicates: false` option.", ); } } else { diff --git a/test/IdAttributePluginTest.js b/test/IdAttributePluginTest.js index ad29b9f2b..0216190e8 100644 --- a/test/IdAttributePluginTest.js +++ b/test/IdAttributePluginTest.js @@ -131,7 +131,7 @@ test("Issue #3424, id attribute conflicts (two hard coded id conflicts)", async elev.disableLogger(); let e = await t.throwsAsync(() => elev.toJSON()); - t.is(e.originalError.originalError.toString(), "Error: Duplicate `id` attribute (testing) in markup on ./test/stubs-virtual/test.html"); + t.is(e.originalError.originalError.toString(), `Error: You have more than one HTML \`id\` attribute using the same value (id="testing") in your template (./test/stubs-virtual/test.html). You can disable this error in the IdAttribute plugin with the \`checkDuplicates: false\` option.`); }); test("Issue #3424, filter callback skips", async (t) => {