1
0
mirror of synced 2026-08-31 22:46:14 +00:00

FEAT: ads.txt support

Adds a plugin setting that holds text content served on a new /ads.txt route.
This commit is contained in:
Penar Musaraj
2019-02-04 16:14:43 -05:00
parent 0debcbf2e8
commit ccad3ca226
3 changed files with 98 additions and 76 deletions
+17
View File
@@ -5,3 +5,20 @@
# url: https://github.com/discourse/discourse-adplugin
register_asset "stylesheets/adplugin.scss"
after_initialize do
require_dependency 'application_controller'
class ::AdstxtController < ::ApplicationController
skip_before_action :check_xhr
def index
raise Discourse::NotFound unless SiteSetting.adsense_ads_txt.present?
render plain: SiteSetting.adsense_ads_txt
end
end
Discourse::Application.routes.append do
get '/ads.txt' => "adstxt#index"
end
end