From 36287c00d56596fbb2672cfe3f9b9dd24b2926da Mon Sep 17 00:00:00 2001 From: Milos Djermanovic Date: Fri, 20 May 2022 02:26:41 +0200 Subject: [PATCH] docs: fix absolute paths in related rules shortcode to work from /docs (#15892) --- docs/.eleventy.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/docs/.eleventy.js b/docs/.eleventy.js index d1138eff322..7b4c4f1a034 100644 --- a/docs/.eleventy.js +++ b/docs/.eleventy.js @@ -25,6 +25,15 @@ const { module.exports = function(eleventyConfig) { let now = new Date(); + /* + * The site is loaded from /docs on eslint.org and so we need to adjust + * the path prefix so URLs are evaluated correctly. + * + * The path prefix is turned off for deploy previews so we can properly + * see changes before deployed. + */ + const pathPrefix = process.env.CONTEXT === "deploy-preview" ? "" : "/docs"; + /***************************************************************************************** * Filters * ***************************************************************************************/ @@ -180,7 +189,7 @@ module.exports = function(eleventyConfig) { rules.forEach(function(rule) { let list_item = `