Skip to content

Commit

Permalink
Do not show dead guides for superseded extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
holly-cummins committed Nov 1, 2024
1 parent 650a38a commit f835bda
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ exports.sourceNodes = async ({
node.metadata.minimumJavaVersion = node.metadata["minimum-java-version"]
delete node.metadata["minimum-java-version"]

node.metadata.guide = await rewriteGuideUrl(extension)

// Look for extensions which are not the same, but which have the same artifact id
// (artifactId is just the 'a' part of the gav, artifact is the whole gav string)

Expand Down Expand Up @@ -210,6 +208,8 @@ exports.sourceNodes = async ({

}

node.metadata.guide = await rewriteGuideUrl(extension)

if (node.metadata) {
// Do the link to the download data
node.metadata.downloads = node.metadata?.maven?.artifactId ? `${node.metadata.maven.groupId}:${node.metadata.maven.artifactId}` : undefined
Expand Down
9 changes: 9 additions & 0 deletions src/components/util/guide-url-rewriter.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ const rewriteGuideUrl = async ({ name, metadata }) => {
originalLink
)
return undefined
}
if (metadata?.isSuperseded) {
console.warn(
"Stripping dead guide link from superseded extension. Extension is:",
name,
"and guide link is",
originalLink
)
return undefined
} else if (metadata?.guide) {
const transforms = [
metadata => metadata.guide.replace("guides", "version/main/guides"),
Expand Down

0 comments on commit f835bda

Please sign in to comment.