Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
Update the migrated_log plugin
Browse files Browse the repository at this point in the history
Add more handling for exceptions
  • Loading branch information
dshevtsov committed Jun 3, 2022
1 parent e3b399b commit ce6341a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions _plugins/generators/migrated_log.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@ def generate(site)
migrated_pages = @site.pages.filter { |page| page.data['layout'] == 'migrated' }

url_prefix = site.config['url'] + site.config['baseurl']

migrated_pages_data = []
migrated_pages.each do |page|
migrated_page = {
path: page.path,
title: page.data['title'],
guide: @site.data['toc'][page.data['group']]['label'],
title: page.data['title'] || abort("Error in '#{page.path}'.\n Check 'title' in the frontmatter.".red),
guide: @site.data.dig('toc', page.data['group'], 'label') || abort("Error in '#{page.path}'.\n Check 'group' in the frontmatter here, or 'label' in the corresponting TOC.".red),
migrated_from: url_prefix + page.url,
migrated_to: page.data['migrated_to'],
migrated_to: page.data['migrated_to'] || abort("Error in '#{page.path}'.\n Check 'migrated_to' in the frontmatter.".red),
migrated_to_source: if page.data['migrated_to'].start_with?('https://experienceleague.adobe.com')
'Adobe Experience League'
elsif page.data['migrated_to'].start_with?('https://developer.adobe.com')
Expand Down

0 comments on commit ce6341a

Please sign in to comment.