Is there a way to import content when the site is already deployed?

I have developed an static product catalog with netlify cms and nuxt.js but i have to upload every product by myself, is there a way to develop an importer using the same way that netlify writes and do the commits to git?

Importing products from an .csv file or .xls file or .json at least.

I want to know is this is posible.

Simply put. Yes.

It depends on how you store your product data. With a JAMstack site you could still access your products via an API call for instance. Alternatively, you could trigger a new build of the site when a product is added if your products are all served statically and held in your git repo etc.

There are quite a few options that would be dependent on your setup.

That’s is what i need. Let say that i build an .csv file importer, i read that file using a serverless function and i have the data from 3 new products.

After all this, i need to write this data on the content directory and then trigger the push to the git backend.

How do i trigger the push to git? Is there a kind of netlify hook, function or service to do it programmatically?

1 Like

Yes, exactly! :slight_smile: - You can create a build hook https://docs.netlify.com/configure-builds/build-hooks/
In your example, the serverless function could then send a post request the URL you’ve generated.

EDIT: I just read that you wanted to trigger a push to git not to build. Let me read into it a sec.


So, off the top of my head based on what you’ve mentioned I would use the github API to make those changes and then netlify will automatically build your production branch. I am just about to get off for the night but will check back tomorrow (UK time) incase there’s no luck!

1 Like

Yes, this would work, with this hook maybe a could write the files and then trigger a build and then a deploy, to persist the new Data. I will try to do it.

It does sound quite long-winded though, have you considered hosting your product data somewhere and pulling it in via API?

@AaronP don’t worry and thank you very much for your help, I’m going to try all this and if i doit I’ll let you know. Thanks

1 Like

I want to avoid this, because I want build something only focused and centralized in the static site