I want to host a security.txt

I would like to add a simple security.txt to the site, but I am not sure how to create the content.

url-assest

If I add the text file as an asset it won’t be available on the correct route.

Hi @jason.dryhurst-smith,

Welcome to the Dato forum!

Normally this would be something that lives as a plaintext file in your frontend, outside both Dato and your frontend framework’s real app. It’s often just a static file in the public folder or similar, kinda like where robots.txt might go. That file gets transcluded into your build, separate from the other pages that get rendered through Javascript.

While you could in theory put the contents of something like that in Dato (and then fetch it as a field and render it to a static page), I wouldn’t recommend it… that’s overkill (and kinda fragile) when a real .txt file would be both simpler and more reliable.

If you tell us more about your frontend framework and hosting setup, maybe we can try to provide more specific guidance?

Hope that helps in the meantime!

It looks to me like your website is on Next.js? If so, this is how you do it for that framework:

Thanks roger. This I think was a lack of awareness on my part about how the CMS and webserver/deployments interacted. I have added the file as static content to the next site. Thanks for your help and patience.

1 Like

No problem, glad you got it working!