diff --git a/lib/helpers/wraith_config_helper.rb b/lib/helpers/wraith_config_helper.rb index 429d4bf5c3..8fc999ee36 100644 --- a/lib/helpers/wraith_config_helper.rb +++ b/lib/helpers/wraith_config_helper.rb @@ -29,11 +29,13 @@ def build_paths if @paths.is_a? Hash @paths.keys.each do |key| @paths.fetch(key).each_with_index do |path, index| - config_paths[path_index(key, index + 1)] = path + config_paths[path_index(key, index + 1)] = path unless path_blacklisted?(path) end end else - @paths.each_with_index { |path, index| config_paths[path_index(name, index + 1)] = path } + @paths.each_with_index do |path, index| + config_paths[path_index(name, index + 1)] = path unless path_blacklisted?(path) + end end config_paths @@ -43,6 +45,19 @@ def path_index(prefix, index) "#{prefix}_#{index}" end + # Remove paths that aren't useful + # + # TODO: Remove when Wraith patched + # Paths containing "path" in them break Wraith: + # https://github.com/BBC-News/wraith/issues/536 + # + # TODO: Remove when Search API no longer returns + # Search API incorrectly returns government-frontend as + # renderer for travel advice index + def path_blacklisted?(path) + path.include?('path') || path == "/foreign-travel-advice" + end + def write_config(config) file_name = OUTPUT_PATH % { suffix: @name } File.open(file_name, 'w') { |f| f.write config.to_yaml }