Add support for ads.txt redirect
This commit is contained in:
@@ -51,6 +51,7 @@ en:
|
||||
adsense_post_bottom_ad_sizes: "Choose your ad size"
|
||||
adsense_mobile_post_bottom_ad_size: "Choose your ad size"
|
||||
adsense_nth_post_code: "Show an ad after every N posts, where N is this value."
|
||||
adsense_ads_txt_url: "URL of ads.txt file."
|
||||
|
||||
amazon_through_trust_level: "Show your ads to users based on trust levels. Users with trust level higher than this value will not see ads."
|
||||
amazon_topic_list_top_src_code: "Enter src code to display at topic list top location"
|
||||
|
||||
+79
-76
File diff suppressed because it is too large
Load Diff
@@ -176,3 +176,20 @@ and (max-width : 775px) {
|
||||
}
|
||||
|
||||
CSS
|
||||
|
||||
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_url.present?
|
||||
|
||||
redirect_to SiteSetting.adsense_ads_txt_url
|
||||
end
|
||||
end
|
||||
|
||||
Discourse::Application.routes.append do
|
||||
get '/ads.txt' => "adstxt#index"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user