Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add robots.txt for non-production websites #2350

Merged
merged 1 commit into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: /
Loading