styxlab / gatsby-theme-try-ghost

A Gatsby theme to build flaring fast blogs from headless Ghost CMS
MIT License
135 stars 56 forks source link

fix: Rewrote gatsby-rehype-ghost-links to use url module instead of relying on string replacement #250

Closed yanneves closed 3 years ago

yanneves commented 3 years ago

Adds tests for this package and removes lodash dependency

I had an issue where even though my Ghost instance is configured with https://example.com with no trailing slash, the settings value in Gatsby would include a trailing slash. This package would then compare using cmsUrl = 'https://example.com//' and fail to replace links.

While the settings value in Gatsby should not include a trailing slash, this package could be more resilient and compare urls via the url module instead of relying on only comparing strings. So I've contributed this refactor / fix with tests.

styxlab commented 3 years ago

Really nice, thanks for that contribution! Will have a more thorough look into it next week.

yanneves commented 3 years ago

I've got a release coming up in the next couple days that depends on this fix - is there anything I can do to help get this merged?

yanneves commented 3 years ago

Thanks so much 👍

styxlab commented 3 years ago

Corresponding npm package will be published tomorrow.

styxlab commented 3 years ago

Published on npm!