Skip to content

Commit e9044ed

Browse files
committed
Do not show dead guides for superseded extensions
1 parent 3fbc391 commit e9044ed

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

gatsby-node.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,6 @@ exports.sourceNodes = async ({
165165
node.metadata.minimumJavaVersion = node.metadata["minimum-java-version"]
166166
delete node.metadata["minimum-java-version"]
167167

168-
node.metadata.guide = await rewriteGuideUrl(extension)
169-
170168
// Look for extensions which are not the same, but which have the same artifact id
171169
// (artifactId is just the 'a' part of the gav, artifact is the whole gav string)
172170

@@ -210,6 +208,8 @@ exports.sourceNodes = async ({
210208

211209
}
212210

211+
node.metadata.guide = await rewriteGuideUrl(node)
212+
213213
if (node.metadata) {
214214
// Do the link to the download data
215215
node.metadata.downloads = node.metadata?.maven?.artifactId ? `${node.metadata.maven.groupId}:${node.metadata.maven.artifactId}` : undefined

src/components/util/guide-url-rewriter.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const rewriteGuideUrl = async ({ name, metadata }) => {
1+
const rewriteGuideUrl = async ({ name, metadata, isSuperseded }) => {
22
// We have to access the url exist as a dynamic import (because CJS), await it because dynamic imports give a promise, and then destructure it to get the default
33
// A simple property read won't work
44
const {
@@ -21,6 +21,14 @@ const rewriteGuideUrl = async ({ name, metadata }) => {
2121
originalLink
2222
)
2323
return undefined
24+
} else if (isSuperseded) {
25+
console.warn(
26+
"Stripping dead guide link from superseded extension. Extension is:",
27+
name,
28+
"and guide link is",
29+
originalLink
30+
)
31+
return undefined
2432
} else if (metadata?.guide) {
2533
const transforms = [
2634
metadata => metadata.guide.replace("guides", "version/main/guides"),

0 commit comments

Comments
 (0)