So, I want to add a ads.js to my site, but the example from Next github is not so clear. Anyone knows how to do it? Here's the next example with robots and a sitemap: https://github.com/zeit/next.js/tree/canary/examples/with-sitemap-and-robots-express-server
Thank you!
Depends on where is this file needs to go you can do one of this options.
if not matter, just drop it inside the /static
folder and call it whit go.to/static/ads.txt
drop it inside /static
folder and add this script to your custom server to handle this new path /ads.txt
in the way to make accessible with go.to/ads.txt
server.get('/ads.txt', (req, res) => {
const filePath = join(__dirname, 'static/ads.txt')
app.serveStatic(req, res, filePath)
})
server.get('*', (req, res) => handle(req, res))
this solution work in the express server.