Deploying downloadable assets (PDF, JSON, TXT, etc.)

This is maybe a dumb question? I have a number of assets: reports, files of all kinds that should be deployed to the website, possibly in special directories. But these files don’t require building a page. How do we include these files so the deployment process would just copy them over.
Our stack is NetlifyCMS, GastbyJS, storage on GitHub, CodeShip for CI/CD pipeline, and serving on S3.
Thanks for your help!

In Gatsby, you can save files in static folder and they’ll be copied as-is. That’s what you’re looking for I guess.

Thanks for your prompt response! I actually knew that, but I should have mentioned additional requirements. I’d like to organize those files in specific directories. For example /versioInfo, /downloads, /pressReleases, etc…

From what I know, the folder structure in static folder is maintained while publishing it live. So that should work, I guess?

1 Like

@pdesmarets, as long as the relative paths to the assets are correct, you shouldn’t have a problem loading those assets into your site.

Great, thank you! I’ll give it a shot.

I confirm that is is working as expected. That was easy enough, and logical. I should have thought about it… Thanks!

1 Like

Actually, I now have a related question… How can these static pages be automatically added to Sitemap.xml ? gatsby-plugin-sitemap works well for the NetlifyCMS-created pages. Who can we automatically add the pages in the folders of the /static directory?

static folder is not touched or processed by Gatsby. It exists for the sole purpose of copying the files as they are. So, what you’re looking for might not be easily possible. You might have to use some another Node Module or something which will read all the files in the specified folder and edit the sitemap accordingly. You can do so by adding command onPostBuild or by building a Netlify plugin.