diff --git a/src/Engines/Custom.js b/src/Engines/Custom.js index e5d9be220..9abcce184 100644 --- a/src/Engines/Custom.js +++ b/src/Engines/Custom.js @@ -323,6 +323,7 @@ class CustomEngine extends TemplateEngine { } // Breaking: default changed from `true` to `false` in 3.0.0-alpha.13 + // Note: `false` is the same as "raw" here. return false; } diff --git a/src/TemplateContent.js b/src/TemplateContent.js index 7d99b5c31..6e5fbe11a 100644 --- a/src/TemplateContent.js +++ b/src/TemplateContent.js @@ -525,10 +525,9 @@ class TemplateContent { // ({ compileOptions: { permalink: false }}) // ({ compileOptions: { permalink: () => false }}) // ({ compileOptions: { permalink: () => (() = > false) }}) - if (permalinkCompilation === false) { + if (permalinkCompilation === false && typeof permalink !== "function") { return permalink; } - /* Custom `compile` function for permalinks, usage: permalink: function(permalinkString, inputPath) { return async function(data) { diff --git a/src/TemplateMap.js b/src/TemplateMap.js index f0e3e93e0..061815088 100644 --- a/src/TemplateMap.js +++ b/src/TemplateMap.js @@ -12,7 +12,7 @@ import TemplateData from "./Data/TemplateData.js"; const debug = debugUtil("Eleventy:TemplateMap"); const debugDev = debugUtil("Dev:Eleventy:TemplateMap"); -class TemplateMapConfigError extends EleventyBaseError {} +class EleventyMapPagesError extends EleventyBaseError {} class EleventyDataSchemaError extends EleventyBaseError {} // These template URL filenames are allowed to exclude file extensions @@ -25,7 +25,7 @@ const EXTENSIONLESS_URL_ALLOWLIST = [ class TemplateMap { constructor(eleventyConfig) { if (!eleventyConfig) { - throw new TemplateMapConfigError("Missing config argument."); + throw new Error("Missing config argument."); } this.eleventyConfig = eleventyConfig; this.map = []; @@ -373,7 +373,14 @@ class TemplateMap { } else { // is a template entry let map = this.getMapEntryForInputPath(depEntry); - map._pages = await map.template.getTemplates(map.data); + try { + map._pages = await map.template.getTemplates(map.data); + } catch (e) { + throw new EleventyMapPagesError( + "Error generating template page(s) for " + map.inputPath + ".", + e, + ); + } if (map._pages.length === 0) { // Reminder: a serverless code path was removed here.