beacon icon indicating copy to clipboard operation
beacon copied to clipboard

Webfiles and Metatags: Generate `robots.txt`

Open AZholtkevych opened this issue 1 year ago • 3 comments

Generate robots.txt for sites.

Each site will have its own robots.txt which must be resolved dynamically by adding a route /robots.txt to https://github.com/BeaconCMS/beacon/blob/7790eb72769a026c0bdfc3167aab394a9b73ce91/lib/beacon/router.ex#L79

A request to that route should call Beacon.Lifecycle.generate_robots_txt/1 which will provide a default implementation that should work for most scenarios:

# http://www.robotstxt.org
User-agent: *
Sitemap: #{endpoint.url()}/sitemap.xml

generate_robots_txt/1 should receive site as argument and call Elixir.Beacon.Config.fetch!(site).endpoint.url() to fetch current site url to be used as prefix for sitemap.xml location.

Then that content should be served as txt.

Depends on #169

Refs

  • http://www.robotstxt.org
  • https://developers.google.com/search/docs/crawling-indexing/robots/intro

AZholtkevych avatar Apr 27 '23 14:04 AZholtkevych

Depends on #95

AZholtkevych avatar Apr 27 '23 14:04 AZholtkevych

Generating the file itself is trivial but we need to research how to serve it on multiple domains

AZholtkevych avatar May 02 '23 10:05 AZholtkevych

@AZholtkevych we can remove the dependency of #95 and add dependency on #169

leandrocp avatar May 04 '23 17:05 leandrocp