
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
BetterRobots is designed to SEO enhance your robots.txt serving, in particular for situations where you have multiple domains or subdomains being served from one application. e.g. www.yoursite.com, assets.yoursite.com, beta.yoursite.com, etc.
A web application commonly has several subdomains that refer to the same application. For example, a standard practice to speed browser page load time, is to have multiple asset hosts aliased to your application, allowing a browser to simultaneously stream multiple assets. In an SEO context, each of these aliased hosts are considered to be duplicate content. To avoid this, you should have different robots.txt that exclude search engines for all but your canonical domain.
BetterRobots provides a robots.txt configuration for your conical domain, optional robots.txt for others, and defaults to disallow for everything that does not have a matching robots.txt.
As a quick example, assume your canonical domain is www.yoursite.com with a subdomain 'assets0' and 'api'. If you rename your robots.txt to www.yoursite.com.robots.txt, the following get requests for robots.txt will return the following:
www.yoursite.com/robots.txt -> User-agent: *
Crawl-Delay: 3
assets0.yoursite.com/robots.txt -> User-agent: *
Disallow: /
api.yoursite.com/robots.txt -> User-agent: *
Disallow: /
Add this line to your application's Gemfile:
gem 'better_robots'
And then execute:
$ bundle
Or install it yourself as:
$ gem install better_robots
For Rails 3 & 4, add a route to config/routes.rb
get "/robots.txt" => BetterRobots::Generator
For each domain name that you want a robots.txt file served, rename your public/robots.txt to the <fully qualified domain name>.robots.txt. e.g. Domain: www.example.org; public/www.example.org.robots.txt All other domain names will default to: User-agent: * Disallow: /
BetterRobots is a Rack based app, and should work with any Rack compatible framework. It has been tested with Rails 3.2, Rails 4.0 and Sinatra 1.3, and on the following Ruby implementations:
This library aims to adhere to Semantic Versioning 2.0.0. Violations of this scheme should be reported as bugs. Specifically, if a minor or patch version is released that breaks backward compatibility, that version should be immediately yanked and/or a new version should be immediately released that restores compatibility. Breaking changes to the public API will only be introduced with new major versions. As a result of this policy, once this gem reaches a 1.0 release, you can (and should) specify a dependency on this gem using the Pessimistic Version Constraint with two digits of precision. For example:
spec.add_dependency 'better_robots', '~> 1.0'
better_robots is released under the MIT license.
FAQs
Unknown package
We found that better_robots demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.