CMS as a React Component? Emded into site etc

Hey! I had a quick look around and couldn’t see this being talked about. However, I was wondering if there are plans in the roadmap for CMS to be available as a component?
I know we’re not support to use CMS as a component but I was trying very hard to include CMS as a react component, I managed to do so (kindve) but as stated it does take over the whole site meaning that the rest of the site attempts to use a hashrouter?

Is there a particular reason the CMS uses hashrouter or could it be configured to use a browserRouter?

I took the route of using the npm install of netlify-cms-app, attempting to have more control over previews and ideally have my own navbar at the top of the CMS.

What are the go to options here when people use CMS as an npm package? I cant find many examples of it being integrated with a site itself, and if the CMS was its own separate site how do you make the content go to a different git repo, would seem a bit weird if that was the route to take?

Another option I thought of was to have the CMS in the same repo as my site but in a different folder, then build it into the public directory of my site, making it accessible in the same way the CDN is?

I didn’t put this as a feature since I’m sure there are solutions to what I am attempting, I just cant figure it out at the moment.

I would be foolish not to mention @talves on this one

3 Likes

Thanks Tom! I’ve seen and tried a few Starters, one of which I think was Talves but they’re all just the CMS alone as a site but not sure how to integrate that into serving the content :slight_smile: Hopefully, he is able to trigger my lightbulb moment.

Hi @AaronP,

I’ve pushed for this quite a bit in the past. Your analysis is pretty much on par with the issues. There needs to be a static entry point for routing on a site like let’s say Gatsby, so you do end up with a 2 build step process at this time. I think it was on the roadmap at one time to get rid of this issue in 3.x, but it’s been awhile since I’ve reviewed the roadmap if it even exists any longer.

All my examples push toward a separate build at this time to show the options you have to extend with netlify-cms-app, but I know that doesn’t solve what you’d like. So currently you still have to build the entry point on it’s own and have your app use a static route to that path.

Another big issue with netlify-cms is the styling of the app as a component which is also not supported at this time. I’ve been in the works doing a POC to see what it would take to fork out netlify-cms and solve all this myself. I can say it would be a huge undertaking and I would have to make it a paid product for it to be sustainable. All that is way up in the air right now.

Sorry that I don’t have better news for you at this time.

2 Likes

This is very doable and you could use shared components for preview, but you’ll still have the issue of not having a styled navigation bar for your site wrapping the CMS.

1 Like

I managed to use your netlify-cms-react-example to have a navigation but the entire routing of the page was via hashRouter (because of the netlify cms using it) and that wouldn’t be ideal.

Do you have any example repos of a two step react build with the CMS?
I am attempting to not use next or gatsby and just have react-snap so probably making it more difficult that it already is :smiley:

Thanks for your time in giving such a detailed reply of what you’ve already been through!
A CMS component would be much more flexible and allow for more use cases, I wonder why its not a priority.

Have you attempted to use any other git based CMS that slot in as a component at all? (Although I’d prefer to keep it Netlify, I wouldnt mind looking how others do it).

1 Like

Not at this time.

I’ve been a maintainer on netlify-cms for over 2 years and since before I came on there was a push to make the cms a drop in application, but it was a bummer it wasn’t architected for the ability to pull out as a component. It just got too far down the road for a turn back I guess in the eyes of the decision makers.

2 Likes

Yeah, that’s a shame from a DX perspective. I’ll take a crack at a 2 step build process and see how I feel about it. Thanks mate!

2 Likes

@AaronP Do feel free to open the discussion over at GitHub

3 Likes