Skip to content

Commit

Permalink
Create latest redirect for every legact redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
epbarger committed Mar 2, 2021
1 parent 923556b commit 9f256fe
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ const createDoc = (navTree, prevNext, doc, productVersions, actions) => {
if (!doc.frontmatter.productStub) {
configureLegacyRedirects({
toPath: doc.fields.path,
toLatestPath: isLatest && replacePathVersion(doc.fields.path),
toLatestPath: replacePathVersion(doc.fields.path),
redirects: (doc.frontmatter.legacyRedirects || []).concat(
doc.frontmatter.legacyRedirectsGenerated || [],
),
Expand Down
3 changes: 1 addition & 2 deletions scripts/legacy_redirects/add_legacy_redirects.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,5 +323,4 @@ def print_csv_report(report_dict):
print("wrote to {0} of {1} mdx files".format(len(output.keys()), mdx_file_count))

print("")
print_csv_report(new_failed_to_match)
# print(len(new_failed_to_match))
# print_csv_report(new_failed_to_match)
6 changes: 3 additions & 3 deletions src/constants/gatsby-node-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,16 +283,16 @@ const configureLegacyRedirects = ({
- redirects from versioned path to new versioned path, latest version
- should these be permanent or temporary?
- latest versioned path will redirect to /latest, meaning you would have two redirects
- if the first redirect is permananet, will we have issues when this is no longer the latest version?
- if the first redirect is permanent, will we have issues when this is no longer the latest version?
- redirects from latest path to new latest path
- these should be temporary
- these should be permanent right?
*/

actions.createRedirect({
fromPath,
toPath: toPath,
redirectInBrowser: false,
isPermanent: false, // should be true when we're confident
isPermanent: false,
});

if (toLatestPath) {
Expand Down

0 comments on commit 9f256fe

Please sign in to comment.