From a3cef26f534d32c286d3352622c839163ee930cb Mon Sep 17 00:00:00 2001 From: Fabian Rodriguez Date: Fri, 20 Dec 2024 08:41:16 -0300 Subject: [PATCH] Programmatically add a redirect from //examples/ to the first example so we can link to that page from everywhere It will also help with the redirects when the migration is over --- app/_plugins/generators/redirects.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/_plugins/generators/redirects.rb b/app/_plugins/generators/redirects.rb index c41a2a55c..0609e1113 100644 --- a/app/_plugins/generators/redirects.rb +++ b/app/_plugins/generators/redirects.rb @@ -6,6 +6,7 @@ class RefirectsGenerator < Jekyll::Generator def generate(site) redirects = api_specs_redirects(site) + redirects << plugin_examples_redirects(site) site.pages << build_page(redirects, site) end @@ -22,5 +23,11 @@ def api_specs_redirects(site) [page.data['base_url'], page.url].join("\t") end end + + def plugin_examples_redirects(site) + site.data.fetch('kong_plugins', {}).map do |_slug, plugin| + ["#{plugin.url}examples/", plugin.data.fetch('get_started_url')].join("\t") + end + end end end