From cb499689209bc89ab721b1369d4ff96cf1079965 Mon Sep 17 00:00:00 2001 From: Nikhil Benesch Date: Thu, 14 Nov 2019 14:17:25 -0500 Subject: [PATCH] Fix Jekyll plugin ordering The FlavorSelector plugin needs to run before the JekyllVersions plugin. We were getting lucky previously with the right order, but For some reason enabling the sitemap plugin caused us to get unlucky. Use more granular plugin priorities to enforce exactly the right ordering. --- _plugins/flavor_selector.rb | 9 ++++++--- _plugins/versions/generator.rb | 7 +++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/_plugins/flavor_selector.rb b/_plugins/flavor_selector.rb index 222204b3348..8ef4a81eed2 100644 --- a/_plugins/flavor_selector.rb +++ b/_plugins/flavor_selector.rb @@ -8,9 +8,12 @@ # open in a new window. module FlavorSelector class Generator < Jekyll::Generator - # Ensure we run after JekyllRedirectFrom, so that if cockroachcloud links to - # a page that *redirects* to the cockroachdb docs, we rewrite that link. - priority :lowest + # Ordering requirements: + # - Run after JekyllRedirectFrom, so that if cockroachcloud links to + # a page that *redirects* to the cockroachdb docs, we rewrite that link. + # - Run before JekyllVersions, so that it doesn't see pages that don't + # apply to this flavor. + priority :low def initialize(config) @config = config diff --git a/_plugins/versions/generator.rb b/_plugins/versions/generator.rb index 5b148ff144a..2a7565dd4b1 100644 --- a/_plugins/versions/generator.rb +++ b/_plugins/versions/generator.rb @@ -1,7 +1,10 @@ module JekyllVersions class JekyllGenerator < Jekyll::Generator - # Ensure we run after JekyllRedirectFrom so we can apply version aliases - # (e.g. stable) to redirects. + # Ordering requirements: + # - Run after JekyllRedirectFrom so we can apply version aliases + # (e.g. stable) to redirects. + # - Run after FlavorSelector, so that we don't see pages that don't + # apply to this flavor. priority :lowest def initialize(config)