Skip to content

Commit

Permalink
fix(nx-dev): Og image path generation (#27456)
Browse files Browse the repository at this point in the history
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

The og images for the blogs are not being generated.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

The og images for all blogs should be generated.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->
  • Loading branch information
ndcunningham authored Aug 15, 2024
1 parent 5c890de commit 2e48ebf
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions nx-dev/data-access-documents/src/lib/blog.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ export class BlogApi {
if (!imagePath) {
return { image: defaultImage, type: defaultType };
}

const { ext } = parse(imagePath);

if (!allowedExtensions.includes(ext)) {
Expand All @@ -190,10 +191,14 @@ export class BlogApi {
}

return {
image: imagePath.replace(ext, foundExt),
image: join('documentation', imagePath.replace(ext, foundExt)),
type: foundExt.replace('.', ''),
};
}
return { image: imagePath, type: ext.replace('.', '') };

return {
image: join('documentation', imagePath),
type: ext.replace('.', ''),
};
}
}

0 comments on commit 2e48ebf

Please sign in to comment.