AndreasGJ / seo-meta-field-nova

MIT License
24 stars 27 forks source link

Always return a default SeoMetaItem #17

Open harmenjanssen opened 3 years ago

harmenjanssen commented 3 years ago

In my opinion, the SEO data acts not so much as "related data", but as attributes of the model.
That's why I think it's a good idea to always return a SeoMetaItem model, to make it safe to assume all SEO properties are there.

I'm motivated by the fact that I'm working on a headless implementation of Nova CMS, creating a JSON API to publish its content to a React application. It's a bit more user-friendly on the front-end to have the API contain page.seo.description = null instead of page.seo = null.

I realize this is opinionated, so let me know if you're willing to merge this, or whether you'd like to see changes. 🙂 Thanks in advance!