jonasmerlin / astro-seo

Makes it easy to add information that is relevant for SEO to your Astro app.
MIT License
933 stars 50 forks source link

Suggest Use Ternaries vs Boolean #1

Closed calendee closed 3 years ago

calendee commented 3 years ago

In SEO.astro, this pattern is used:

{ title && <title>{title}</title> }

In some circumstances (admittedly uncommon), this can cause issues with rendering. I've personally run into this myself.

Id' suggest this pattern instead:

{ title ? <title>{title}</title> : null }

I'd be happy to make a PR for this if you'd like.

Reference: https://kentcdodds.com/blog/use-ternaries-rather-than-and-and-in-jsx

jonasmerlin commented 3 years ago

Thank you for bringing this to my attention! No need to PR, I will fix this immediately and release a new version.

jonasmerlin commented 3 years ago

This is done in v0.3.7