Skip to content

Commit

Permalink
add robots.txt for non-production websites (#2350)
Browse files Browse the repository at this point in the history
  • Loading branch information
SebouChu authored Oct 19, 2024
1 parent e3aad9c commit 414af54
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
15 changes: 15 additions & 0 deletions app/models/communication/website/configs/robots_txt.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class Communication::Website::Configs::RobotsTxt < Communication::Website::Configs::Base

def self.polymorphic_name
'Communication::Website::Configs::RobotsTxt'
end

def git_path(website)
"static/robots.txt"
end

def template_static
"admin/communication/websites/configs/robots_txt/static"
end

end
8 changes: 7 additions & 1 deletion app/models/communication/website/with_configs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ def configs
config_default_permalinks,
config_development_config,
config_production_config,
config_deuxfleurs_workflow
config_deuxfleurs_workflow,
config_robots_txt,
].compact
end

Expand Down Expand Up @@ -39,5 +40,10 @@ def config_deuxfleurs_workflow
@config_deuxfleurs_workflow ||= Communication::Website::Configs::DeuxfleursWorkflow.find(id)
end

def config_robots_txt
return if in_production?
@config_robots_txt ||= Communication::Website::Configs::RobotsTxt.find(id)
end

end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# DO NOT EDIT THIS FILE BY HAND - IT WILL BE OVERWRITTEN BY OSUNY
User-Agent: *
Disallow: /

0 comments on commit 414af54

Please sign in to comment.