Class: SeoController
- Inherits:
-
Eksa::Controller
- Object
- Eksa::Controller
- SeoController
- Defined in:
- app/controllers/seo_controller.rb
Instance Attribute Summary
Attributes inherited from Eksa::Controller
#flash, #redirect_url, #request, #status
Instance Method Summary collapse
Methods inherited from Eksa::Controller
#initialize, #params, #redirect_to, #render
Constructor Details
This class inherits a constructor from Eksa::Controller
Instance Method Details
#robots ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 |
# File 'app/controllers/seo_controller.rb', line 2 def robots content = <<~TEXT User-agent: * Allow: / Disallow: /hapus Disallow: /edit Sitemap: https://#{request.host}/sitemap.xml TEXT [200, { "Content-Type" => "text/plain" }, [content]] end |
#sitemap ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/seo_controller.rb', line 14 def sitemap lastmod = Time.now.strftime("%Y-%m-%d") xml = '<?xml version="1.0" encoding="UTF-8"?>' xml += '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' ["/", "/about", "/docs", "/kontak"].each do |path| xml += "<url>" xml += "<loc>https://#{request.host}#{path}</loc>" xml += "<lastmod>#{lastmod}</lastmod>" xml += "<priority>0.8</priority>" xml += "</url>" end xml += '</urlset>' [200, { "Content-Type" => "application/xml" }, [xml]] end |