From d85e0d09c321bf3b7343e772cbe1a8456c82f425 Mon Sep 17 00:00:00 2001 From: Misty Stanley-Jones Date: Thu, 4 Jan 2018 14:48:38 -0800 Subject: [PATCH] Try to fix JS TOC logic (#5666) --- _layouts/docs.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/_layouts/docs.html b/_layouts/docs.html index 548c7554c0..e14b9489d4 100644 --- a/_layouts/docs.html +++ b/_layouts/docs.html @@ -312,7 +312,13 @@ // See js/archive.js and js/docs.js for logic relating to this var isArchive = true; var dockerVersion = 'v{{ site.docker_ce_stable_version }}'; - var pageURL = '{{ page.url }}'; + // In archives, we need to know the page root and we get it from JEKYLL_ENV in the jekyll build command + var jekyllEnv = '{{ jekyll.environment }}'; + // If unset (in non-archive branches), defaults to "development". In that case, reset it to empty + if (jekyllEnv == 'development') { + jekyllEnv = ''; + } + var pageURL = jekyllEnv + '{{ page.url }}';