Use a robots.txt file in the root

Feature Card

Description

Right now we are returning a default robots.txt file:

Even though we want to provide a Frontity package to configure the robots.txt file using the Frontity settings in the future, it’d be great to be able to configure it using a file in your root directory as well, similar to what we are doing for the favicon.ico.

User Stories

As a Frontity project developer
I want to use a robots.txt file
so that I can get control of my robots easily

Possible solution

I guess we have to check if the file exists first. If it does return it and if it doesn’t, return the default string like we are doing right now.

Is not possible to use now.json routes to get this file? Right now I need to put some redirects in robots.txt

@koli14 has just made a pull request to implement this feature :slightly_smiling_face:

Moving this to Currently in Development.

1 Like

I’m sorry we didn’t answer you @christian.nascimento!

This has been included in the latest release! Thanks @koli14 for implementing it :slightly_smiling_face:

You can now add the robots.txt file at the root of your theme (next to the frontity.settings.js file) and when you build and deploy your app for production, it will be automatically picked up by the Frontity server and served at https://your-site-url.xyx/robots.txt.

2 Likes