Skip to content

Commit

Permalink
Fix Jekyll plugin ordering
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
benesch committed Nov 14, 2019
1 parent 422fa61 commit cb49968
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
9 changes: 6 additions & 3 deletions _plugins/flavor_selector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions _plugins/versions/generator.rb
Original file line number Diff line number Diff line change
@@ -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)
Expand Down

0 comments on commit cb49968

Please sign in to comment.