From 473ed90656f9f12d9293ac354b41f3ff7d5a948b Mon Sep 17 00:00:00 2001 From: Michael Heap Date: Mon, 13 Jun 2022 11:05:43 +0100 Subject: [PATCH] Fix edit link on /latest/ pages --- app/_plugins/generators/latest_version_generator.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/_plugins/generators/latest_version_generator.rb b/app/_plugins/generators/latest_version_generator.rb index 29847dd96d3d..59bca55e1737 100644 --- a/app/_plugins/generators/latest_version_generator.rb +++ b/app/_plugins/generators/latest_version_generator.rb @@ -48,7 +48,8 @@ def generate(site) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexi page.url.gsub(release_path, 'latest'), page.content, page.data, - @page_index["#{product_name}/#{release_path}/"] + @page_index["#{product_name}/#{release_path}/"], + page.path ) site.pages << page end @@ -67,18 +68,19 @@ def remove_generated_prefix(path) end class DuplicatePage < ::Jekyll::Page - def initialize(site, base_dir, path, content, data, page_index) # rubocop:disable Lint/MissingSuper, Metrics/ParameterLists + def initialize(site, base_dir, url, content, data, page_index, path) # rubocop:disable Lint/MissingSuper, Metrics/ParameterLists, Metrics/MethodLength @site = site @base = base_dir @content = content - @dir = path + @dir = url @name = 'index.md' process(@name) @data = data.clone @data['is_latest'] = true @data['version-index'] = page_index + @data['edit_link'] = "app/#{path}" @data['alias'] = [@dir.sub('latest/', '')] if @dir.end_with?('/latest/') end