mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-01-24 01:07:52 -05:00
16 lines
446 B
Ruby
16 lines
446 B
Ruby
class RobotsController < ApplicationController
|
|
DEFAULT_FILENAME = 'config/robots.txt'.freeze
|
|
|
|
def robots
|
|
filename = "config/robots.#{subdomain}.txt" if subdomain && subdomain != 'www'
|
|
file_to_render = File.exist?(filename.to_s) ? filename : DEFAULT_FILENAME
|
|
render file: file_to_render, layout: false, content_type: 'text/plain'
|
|
end
|
|
|
|
private
|
|
|
|
def subdomain
|
|
request.subdomain.present? ? request.subdomain : nil
|
|
end
|
|
end
|