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

Commit 294bb27

Browse files
authored
Merge pull request magento-commerce/devdocs#3226
Add migration metadata
2 parents 45539d2 + 2c6bd00 commit 294bb27

File tree

7 files changed

+55
-10
lines changed

7 files changed

+55
-10
lines changed

_config.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ defaults:
9696
scope:
9797
path: mftf/v2
9898
values:
99+
guide_version: '2.3'
99100
group: mftf-v2
100101
github_files: https://github.com/magento/magento2-functional-testing-framework/tree/2.6.5/
101102
github_repo: https://github.com/magento/magento2-functional-testing-framework/
@@ -206,7 +207,7 @@ algolia:
206207
# It is safe to use in production front-end code.
207208
# Used at src/_includes/layout/header-scripts.html
208209
# For more details, refer to: https://www.algolia.com/doc/guides/security/api-keys/#search-only-api-key
209-
search_only_key: d2d0f33ab73e291ef8d88d8b565e754c
210+
search_only_key: d2d0f33ab73e291ef8d88d8b565e754c #gitleaks:allow
210211

211212
google:
212213
gtm: GTM-KRCLXBB

_plugins/generators/migrated_log.rb

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
# Copyright © Adobe, Inc. All rights reserved.
44
# See COPYING.txt for license details.
55

6-
# This plugin generates the page that contains a list of migrated topics.
6+
# This plugin generates the page that contains a list of migrated topics: https://devdocs.magento.com/migrated.html
7+
# Also, it adds global data:
8+
# - site.data.migration.migrated_pages
9+
# - site.data.migration.deprecated_pages
10+
# - site.data.migration.all_migrating_pages
11+
# - site.data.migration.remained_migrating_pages
712
#
813

914
module Jekyll
@@ -12,19 +17,27 @@ class MigratedLog < Generator
1217
safe true
1318

1419
def generate(site)
15-
# Make the site object available in any scope in this class.
1620
@site = site
1721
pages = @site.pages
18-
migrated_pages = pages.filter { |page| page.data['layout'] and page.data['layout'].include? 'migrated' }
19-
number_of_staying_pages = pages.count { |page| page.data['guide_version'] == '2.3' || page.data['group'].nil? }
22+
migrated_pages = pages.select { |page| page.data['layout']&.include? 'migrated' }
23+
v2_3_pages = pages.select { |page| page.data['guide_version'] == '2.3' }
24+
remained_pages = pages - v2_3_pages
25+
deprecated_pages = remained_pages.select { |page| page.data['group'].nil? || page.data['redirect_to'] }
26+
all_migrating_pages = remained_pages - deprecated_pages
27+
remained_migrating_pages = all_migrating_pages - migrated_pages
2028
migrated_pages_data = []
2129

30+
# Create an array of JSON objects that contain metadata for migrated pages
2231
migrated_pages.each do |page|
2332
migrated_page = {
2433
path: page.path,
2534
title: page.data['title'] || abort("Error in '#{page.path}'.\n Check 'title' in the file's frontmatter.".red),
26-
guide: page.data['layout'].include?('video') ? 'Video Tutorials' : @site.data.dig('toc', page.data['group'],
27-
'label') || abort("Error in '#{page.path}'.\n Check 'group' in the file's frontmatter or 'label' in the corresponding TOC.".red),
35+
guide: if page.data['layout'].include?('video')
36+
'Video Tutorials'
37+
else
38+
@site.data.dig('toc', page.data['group'],
39+
'label') || abort("Error in '#{page.path}'.\n Check 'group' in the file's frontmatter or 'label' in the corresponding TOC.".red)
40+
end,
2841
migrated_from: site.baseurl + page.url,
2942
migrated_to: page.data['migrated_to'] || abort("Error in '#{page.path}'.\n Check 'migrated_to' in the file's frontmatter.".red),
3043
migrated_to_source: if page.data['migrated_to'].start_with?('https://experienceleague.adobe.com')
@@ -38,8 +51,10 @@ def generate(site)
3851
migrated_pages_data << migrated_page
3952
end
4053

54+
# Group migrated pages by guide
4155
migrated_pages_by_group = migrated_pages_data.group_by { |page| page[:guide] }.sort.to_h
42-
content = "The folowing #{migrated_pages.size} topics out of #{pages.size - number_of_staying_pages} have been migrated and will be redirected soon.\n\n"
56+
# Introductory text in the Migrated topics page
57+
content = "The folowing #{migrated_pages.size} topics out of #{all_migrating_pages.size} have been migrated and will be redirected soon.\n\n"
4358
migrated_pages_by_group.each do |guide, topics|
4459
content += "\n## #{guide}\n\n\n"
4560
topics.sort_by { |topic| topic[:title] }
@@ -48,6 +63,18 @@ def generate(site)
4863
end
4964
end
5065

66+
content += "\n***\n\n\n"
67+
content += "\n## Pages to be migrated\n\n\n"
68+
69+
if remained_migrating_pages.empty?
70+
content += 'All 2.4 and versionless pages were migrated'
71+
else
72+
remained_migrating_pages.sort_by(&:path)
73+
.each do |page|
74+
content += "1. `#{page.path}`\n"
75+
end
76+
end
77+
5178
# PageWithoutAFile handles processing files without reading it.
5279
# 'migrated.md' is a virtual file that's been created during Jekyll run.
5380
# See details in https://www.rubydoc.info/gems/jekyll/Jekyll/PageWithoutAFile
@@ -68,6 +95,16 @@ def generate(site)
6895
# Add the newly constructed page object to the rest of pages
6996
# on the site.
7097
pages << topic
98+
99+
site.data['migration'] =
100+
{
101+
'migrated_pages' => migrated_pages.map(&:path),
102+
'deprecated_pages' => deprecated_pages.map(&:path),
103+
'all_migrating_pages' => all_migrating_pages.map(&:path),
104+
'remained_migrating_pages' => remained_migrating_pages.map(&:path)
105+
}
106+
107+
migrated_pages_data
71108
end
72109
end
73110
end

src/_data/main-nav.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,11 @@
271271

272272
- label: Functional Acceptance Testing (MFTF)
273273
url: https://developer.adobe.com/commerce/testing/functional-testing-framework/
274-
versionless: true
274+
include_versions: ["2.4"]
275+
276+
- label: Functional Acceptance Testing (MFTF)
277+
url: https://devdocs.magento.com/mftf/v2/docs/introduction.html
278+
include_versions: ["2.3"]
275279

276280
- label: Integration Testing
277281
url: https://developer.adobe.com/commerce/testing/guide/integration/

src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
projects
1919
<br></br>
2020
Some content was consolidated or moved to different guides. If you can't find a topic, check the <a
21-
href="https://devdocs.magento.com/migrated.html">Migrated topics</a> list for the new link.
21+
href="{{site.baseurl}}/migrated.html">Migrated topics</a> list for the new link.
2222
</header>
2323
</section>
2424

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
guide_version: 2.3
23
layout: redoc
34
specUrl: async-admin-schema.json
45
---
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
guide_version: 2.3
23
layout: redoc
34
specUrl: async-customer-schema.json
45
---
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
guide_version: 2.3
23
layout: redoc
34
specUrl: async-guest-schema.json
45
---

0 commit comments

Comments
 (0)