Skip to content

Commit

Permalink
Fixes #3472
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Dec 9, 2024
1 parent c84f381 commit 117e7e6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/Engines/Custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
3 changes: 1 addition & 2 deletions src/TemplateContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
13 changes: 10 additions & 3 deletions src/TemplateMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 = [];
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 117e7e6

Please sign in to comment.