Module: SiteMaps::RobotsTxt
- Defined in:
- lib/site_maps/robots_txt.rb
Class Method Summary collapse
Class Method Details
.render(sitemap_url: nil, extra_directives: []) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/site_maps/robots_txt.rb', line 13 def render(sitemap_url: nil, extra_directives: []) lines = ["User-agent: *", "Allow: /"] extra_directives.each { |d| lines << d } lines << sitemap_directive(sitemap_url) lines.join("\n") + "\n" end |
.sitemap_directive(url = nil) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/site_maps/robots_txt.rb', line 6 def sitemap_directive(url = nil) url ||= SiteMaps.current_adapter&.config&.url raise ArgumentError, "No sitemap URL provided and no adapter configured" unless url "Sitemap: #{url}" end |