moxystudio / next-with-moxy

MOXY's boilerplate to accelerate the setup of new Next.js based web applications
https://next-with.moxy.tech
MIT License
101 stars 11 forks source link

docs: contentful recipe #87

Closed dominguesgm closed 4 years ago

dominguesgm commented 4 years ago

Include recipe documentation for using the Contentful CMS.

Contains instructions on how to configure Contentful's content models, integration on the application side, and more advanced details like usage with Redux, preview banner rendering, translations, custom per-page SEO and custom caching.

dominguesgm commented 4 years ago

Some issues came up in regards to the Custom Cache Layer which I would like to discuss.

In short, we need to know the SITE_URL in order to setup the Contentful client to direct its requests there so our endpoint can serve as a proxy to the Contentful server (this only applies in production environments).

However, in the case of staging, the SITE_URL is not configured for moxy.in URLs. This will cause the Contentful client to point to the endpoint on a cloudrun url, which will cause CORS issues.

Should we perhaps use a different NODE_ENV value in staging servers so as to avoid proxying the Contentful requests in those scenarios? Or is there a way to configure the correct SITE_URL for our staging links (which would imply CI/CD pipeline recipe changes)?

Any thoughts on this @satazor @acostalima @AfonsoVReis @paulobmarcos?

satazor commented 4 years ago

@dominguesgm I think we should edit the pipeline recipe to use moxy.in in SITE_URL for staging (releases + latest master),

dominguesgm commented 4 years ago

I can create an issue so we can tackle it after, sounds good?

satazor commented 4 years ago

@dominguesgm sounds good to me.

dominguesgm commented 4 years ago

I wanted to write this as a response to the last comment in your review, @paulobmarcos, but I don't seem to be able to.

What if you have a default tag for og:image and then write one through the SEO component? You wouldn't be able to use keys to avoid duplication as the default og:image tag would be set before the SEO component is rendered.

This is why the approach I suggested was combining the default and CMS tags in an object that will be fed to the SEO component.