FEAT: ads.txt support
Adds a plugin setting that holds text content served on a new /ads.txt route.
This commit is contained in:
parent
0debcbf2e8
commit
ccad3ca226
|
@ -51,6 +51,7 @@ en:
|
||||||
adsense_post_bottom_ad_sizes: "Choose your ad size"
|
adsense_post_bottom_ad_sizes: "Choose your ad size"
|
||||||
adsense_mobile_post_bottom_ad_size: "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_nth_post_code: "Show an ad after every N posts, where N is this value."
|
||||||
|
adsense_ads_txt: "Contents of your ads.txt file. More details available at <a href='https://support.google.com/adsense/answer/7532444?hl=en' target='_blank'>this Google AdSense help page</a>."
|
||||||
|
|
||||||
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_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"
|
amazon_topic_list_top_src_code: "Enter src code to display at topic list top location"
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
adsense_plugin:
|
adsense_plugin:
|
||||||
adsense_publisher_code:
|
adsense_publisher_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
regex: '^[\d]*$'
|
regex: '^[\d]*$'
|
||||||
adsense_through_trust_level:
|
adsense_through_trust_level:
|
||||||
client: true
|
client: true
|
||||||
default: 2
|
default: 2
|
||||||
enum: 'TrustLevelSetting'
|
enum: "TrustLevelSetting"
|
||||||
adsense_topic_list_top_code:
|
adsense_topic_list_top_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
max: 50
|
max: 50
|
||||||
regex: '^[\d]*$'
|
regex: '^[\d]*$'
|
||||||
adsense_topic_list_top_ad_sizes:
|
adsense_topic_list_top_ad_sizes:
|
||||||
client: true
|
client: true
|
||||||
default: '728*90 - leaderboard'
|
default: "728*90 - leaderboard"
|
||||||
type: enum
|
type: enum
|
||||||
choices: &adsense_choices
|
choices: &adsense_choices
|
||||||
- responsive
|
- responsive
|
||||||
|
@ -36,94 +36,98 @@ adsense_plugin:
|
||||||
- 690*250
|
- 690*250
|
||||||
adsense_mobile_topic_list_top_code:
|
adsense_mobile_topic_list_top_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
max: 50
|
max: 50
|
||||||
regex: '^[\d]*$'
|
regex: '^[\d]*$'
|
||||||
adsense_mobile_topic_list_top_ad_size:
|
adsense_mobile_topic_list_top_ad_size:
|
||||||
client: true
|
client: true
|
||||||
default: 'responsive'
|
default: "responsive"
|
||||||
type: enum
|
type: enum
|
||||||
choices: *adsense_choices
|
choices: *adsense_choices
|
||||||
adsense_topic_above_post_stream_code:
|
adsense_topic_above_post_stream_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
max: 50
|
max: 50
|
||||||
regex: '^[\d]*$'
|
regex: '^[\d]*$'
|
||||||
adsense_topic_above_post_stream_ad_sizes:
|
adsense_topic_above_post_stream_ad_sizes:
|
||||||
client: true
|
client: true
|
||||||
default: '728*90 - leaderboard'
|
default: "728*90 - leaderboard"
|
||||||
type: enum
|
type: enum
|
||||||
choices: *adsense_choices
|
choices: *adsense_choices
|
||||||
adsense_mobile_topic_above_post_stream_code:
|
adsense_mobile_topic_above_post_stream_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
max: 50
|
max: 50
|
||||||
regex: '^[\d]*$'
|
regex: '^[\d]*$'
|
||||||
adsense_mobile_topic_above_post_stream_ad_size:
|
adsense_mobile_topic_above_post_stream_ad_size:
|
||||||
client: true
|
client: true
|
||||||
default: 'responsive'
|
default: "responsive"
|
||||||
type: enum
|
type: enum
|
||||||
choices: *adsense_choices
|
choices: *adsense_choices
|
||||||
adsense_topic_above_suggested_code:
|
adsense_topic_above_suggested_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
max: 50
|
max: 50
|
||||||
regex: '^[\d]*$'
|
regex: '^[\d]*$'
|
||||||
adsense_topic_above_suggested_ad_sizes:
|
adsense_topic_above_suggested_ad_sizes:
|
||||||
client: true
|
client: true
|
||||||
default: '728*90 - leaderboard'
|
default: "728*90 - leaderboard"
|
||||||
type: enum
|
type: enum
|
||||||
choices: *adsense_choices
|
choices: *adsense_choices
|
||||||
adsense_mobile_topic_above_suggested_code:
|
adsense_mobile_topic_above_suggested_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
max: 50
|
max: 50
|
||||||
regex: '^[\d]*$'
|
regex: '^[\d]*$'
|
||||||
adsense_mobile_topic_above_suggested_ad_size:
|
adsense_mobile_topic_above_suggested_ad_size:
|
||||||
client: true
|
client: true
|
||||||
default: 'responsive'
|
default: "responsive"
|
||||||
type: enum
|
type: enum
|
||||||
choices: *adsense_choices
|
choices: *adsense_choices
|
||||||
adsense_post_bottom_code:
|
adsense_post_bottom_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
max: 50
|
max: 50
|
||||||
regex: '^[\d]*$'
|
regex: '^[\d]*$'
|
||||||
adsense_post_bottom_ad_sizes:
|
adsense_post_bottom_ad_sizes:
|
||||||
client: true
|
client: true
|
||||||
default: '728*90 - leaderboard'
|
default: "728*90 - leaderboard"
|
||||||
type: enum
|
type: enum
|
||||||
choices: *adsense_choices
|
choices: *adsense_choices
|
||||||
adsense_mobile_post_bottom_code:
|
adsense_mobile_post_bottom_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
max: 50
|
max: 50
|
||||||
regex: '^[\d]*$'
|
regex: '^[\d]*$'
|
||||||
adsense_mobile_post_bottom_ad_size:
|
adsense_mobile_post_bottom_ad_size:
|
||||||
client: true
|
client: true
|
||||||
default: 'responsive'
|
default: "responsive"
|
||||||
type: enum
|
type: enum
|
||||||
choices: *adsense_choices
|
choices: *adsense_choices
|
||||||
adsense_nth_post_code:
|
adsense_nth_post_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
min: 1
|
min: 1
|
||||||
|
adsense_ads_txt:
|
||||||
|
client: false
|
||||||
|
default: ""
|
||||||
|
textarea: true
|
||||||
|
|
||||||
dfp_plugin:
|
dfp_plugin:
|
||||||
dfp_publisher_id:
|
dfp_publisher_id:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
dfp_through_trust_level:
|
dfp_through_trust_level:
|
||||||
client: true
|
client: true
|
||||||
default: 2
|
default: 2
|
||||||
enum: 'TrustLevelSetting'
|
enum: "TrustLevelSetting"
|
||||||
dfp_topic_list_top_code:
|
dfp_topic_list_top_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
max: 50
|
max: 50
|
||||||
dfp_topic_list_top_ad_sizes:
|
dfp_topic_list_top_ad_sizes:
|
||||||
client: true
|
client: true
|
||||||
default: '728*90 - leaderboard'
|
default: "728*90 - leaderboard"
|
||||||
type: enum
|
type: enum
|
||||||
choices: &dfp_choices
|
choices: &dfp_choices
|
||||||
- 728*90 - leaderboard
|
- 728*90 - leaderboard
|
||||||
|
@ -161,102 +165,102 @@ dfp_plugin:
|
||||||
- 168*28
|
- 168*28
|
||||||
dfp_mobile_topic_list_top_code:
|
dfp_mobile_topic_list_top_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
max: 50
|
max: 50
|
||||||
dfp_mobile_topic_list_top_ad_sizes:
|
dfp_mobile_topic_list_top_ad_sizes:
|
||||||
client: true
|
client: true
|
||||||
default: '320*50 - mobile leaderboard'
|
default: "320*50 - mobile leaderboard"
|
||||||
type: enum
|
type: enum
|
||||||
choices: *dfp_choices
|
choices: *dfp_choices
|
||||||
dfp_target_topic_list_top_key_code:
|
dfp_target_topic_list_top_key_code:
|
||||||
default: ''
|
default: ""
|
||||||
type: value_list
|
type: value_list
|
||||||
client: true
|
client: true
|
||||||
dfp_target_topic_list_top_value_code:
|
dfp_target_topic_list_top_value_code:
|
||||||
default: ''
|
default: ""
|
||||||
type: value_list
|
type: value_list
|
||||||
client: true
|
client: true
|
||||||
dfp_topic_above_post_stream_code:
|
dfp_topic_above_post_stream_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
max: 50
|
max: 50
|
||||||
dfp_topic_above_post_stream_ad_sizes:
|
dfp_topic_above_post_stream_ad_sizes:
|
||||||
client: true
|
client: true
|
||||||
default: '728*90 - leaderboard'
|
default: "728*90 - leaderboard"
|
||||||
type: enum
|
type: enum
|
||||||
choices: *dfp_choices
|
choices: *dfp_choices
|
||||||
dfp_mobile_topic_above_post_stream_code:
|
dfp_mobile_topic_above_post_stream_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
max: 50
|
max: 50
|
||||||
dfp_mobile_topic_above_post_stream_ad_sizes:
|
dfp_mobile_topic_above_post_stream_ad_sizes:
|
||||||
client: true
|
client: true
|
||||||
default: '320*50 - mobile leaderboard'
|
default: "320*50 - mobile leaderboard"
|
||||||
type: enum
|
type: enum
|
||||||
choices: *dfp_choices
|
choices: *dfp_choices
|
||||||
dfp_target_topic_above_post_stream_key_code:
|
dfp_target_topic_above_post_stream_key_code:
|
||||||
default: ''
|
default: ""
|
||||||
type: value_list
|
type: value_list
|
||||||
client: true
|
client: true
|
||||||
dfp_target_topic_above_post_stream_value_code:
|
dfp_target_topic_above_post_stream_value_code:
|
||||||
default: ''
|
default: ""
|
||||||
type: value_list
|
type: value_list
|
||||||
client: true
|
client: true
|
||||||
dfp_topic_above_suggested_code:
|
dfp_topic_above_suggested_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
max: 50
|
max: 50
|
||||||
dfp_topic_above_suggested_ad_sizes:
|
dfp_topic_above_suggested_ad_sizes:
|
||||||
client: true
|
client: true
|
||||||
default: '728*90 - leaderboard'
|
default: "728*90 - leaderboard"
|
||||||
type: enum
|
type: enum
|
||||||
choices: *dfp_choices
|
choices: *dfp_choices
|
||||||
dfp_mobile_topic_above_suggested_code:
|
dfp_mobile_topic_above_suggested_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
max: 50
|
max: 50
|
||||||
dfp_mobile_topic_above_suggested_ad_sizes:
|
dfp_mobile_topic_above_suggested_ad_sizes:
|
||||||
client: true
|
client: true
|
||||||
default: '320*50 - mobile leaderboard'
|
default: "320*50 - mobile leaderboard"
|
||||||
type: enum
|
type: enum
|
||||||
choices: *dfp_choices
|
choices: *dfp_choices
|
||||||
dfp_target_topic_above_suggested_key_code:
|
dfp_target_topic_above_suggested_key_code:
|
||||||
default: ''
|
default: ""
|
||||||
type: value_list
|
type: value_list
|
||||||
client: true
|
client: true
|
||||||
dfp_target_topic_above_suggested_value_code:
|
dfp_target_topic_above_suggested_value_code:
|
||||||
default: ''
|
default: ""
|
||||||
type: value_list
|
type: value_list
|
||||||
client: true
|
client: true
|
||||||
max: 50
|
max: 50
|
||||||
dfp_nth_post_code:
|
dfp_nth_post_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
min: 1
|
min: 1
|
||||||
dfp_post_bottom_code:
|
dfp_post_bottom_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
max: 50
|
max: 50
|
||||||
dfp_post_bottom_ad_sizes:
|
dfp_post_bottom_ad_sizes:
|
||||||
client: true
|
client: true
|
||||||
default: '728*90 - leaderboard'
|
default: "728*90 - leaderboard"
|
||||||
type: enum
|
type: enum
|
||||||
choices: *dfp_choices
|
choices: *dfp_choices
|
||||||
dfp_mobile_post_bottom_code:
|
dfp_mobile_post_bottom_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
max: 50
|
max: 50
|
||||||
dfp_mobile_post_bottom_ad_sizes:
|
dfp_mobile_post_bottom_ad_sizes:
|
||||||
client: true
|
client: true
|
||||||
default: '320*50 - mobile leaderboard'
|
default: "320*50 - mobile leaderboard"
|
||||||
type: enum
|
type: enum
|
||||||
choices: *dfp_choices
|
choices: *dfp_choices
|
||||||
dfp_target_post_bottom_key_code:
|
dfp_target_post_bottom_key_code:
|
||||||
default: ''
|
default: ""
|
||||||
type: value_list
|
type: value_list
|
||||||
client: true
|
client: true
|
||||||
dfp_target_post_bottom_value_code:
|
dfp_target_post_bottom_value_code:
|
||||||
default: ''
|
default: ""
|
||||||
type: value_list
|
type: value_list
|
||||||
client: true
|
client: true
|
||||||
|
|
||||||
|
@ -264,98 +268,98 @@ amazon_plugin:
|
||||||
amazon_through_trust_level:
|
amazon_through_trust_level:
|
||||||
client: true
|
client: true
|
||||||
default: 2
|
default: 2
|
||||||
enum: 'TrustLevelSetting'
|
enum: "TrustLevelSetting"
|
||||||
amazon_topic_list_top_src_code:
|
amazon_topic_list_top_src_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
amazon_topic_list_top_ad_width_code:
|
amazon_topic_list_top_ad_width_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
amazon_topic_list_top_ad_height_code:
|
amazon_topic_list_top_ad_height_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
amazon_mobile_topic_list_top_src_code:
|
amazon_mobile_topic_list_top_src_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
amazon_mobile_topic_list_top_ad_width_code:
|
amazon_mobile_topic_list_top_ad_width_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
amazon_mobile_topic_list_top_ad_height_code:
|
amazon_mobile_topic_list_top_ad_height_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
amazon_topic_above_post_stream_src_code:
|
amazon_topic_above_post_stream_src_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
amazon_topic_above_post_stream_ad_width_code:
|
amazon_topic_above_post_stream_ad_width_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
amazon_topic_above_post_stream_ad_height_code:
|
amazon_topic_above_post_stream_ad_height_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
amazon_mobile_topic_above_post_stream_src_code:
|
amazon_mobile_topic_above_post_stream_src_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
amazon_mobile_topic_above_post_stream_ad_width_code:
|
amazon_mobile_topic_above_post_stream_ad_width_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
amazon_mobile_topic_above_post_stream_ad_height_code:
|
amazon_mobile_topic_above_post_stream_ad_height_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
amazon_topic_above_suggested_src_code:
|
amazon_topic_above_suggested_src_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
amazon_topic_above_suggested_ad_width_code:
|
amazon_topic_above_suggested_ad_width_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
amazon_topic_above_suggested_ad_height_code:
|
amazon_topic_above_suggested_ad_height_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
amazon_mobile_topic_above_suggested_src_code:
|
amazon_mobile_topic_above_suggested_src_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
amazon_mobile_topic_above_suggested_ad_width_code:
|
amazon_mobile_topic_above_suggested_ad_width_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
amazon_mobile_topic_above_suggested_ad_height_code:
|
amazon_mobile_topic_above_suggested_ad_height_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
amazon_post_bottom_src_code:
|
amazon_post_bottom_src_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
amazon_nth_post_code:
|
amazon_nth_post_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
min: 1
|
min: 1
|
||||||
amazon_post_bottom_ad_width_code:
|
amazon_post_bottom_ad_width_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
amazon_post_bottom_ad_height_code:
|
amazon_post_bottom_ad_height_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
amazon_mobile_post_bottom_src_code:
|
amazon_mobile_post_bottom_src_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
amazon_mobile_post_bottom_ad_width_code:
|
amazon_mobile_post_bottom_ad_width_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
amazon_mobile_post_bottom_ad_height_code:
|
amazon_mobile_post_bottom_ad_height_code:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
|
|
||||||
codefund_plugin:
|
codefund_plugin:
|
||||||
codefund_property_id:
|
codefund_property_id:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ""
|
||||||
codefund_advertiser_label:
|
codefund_advertiser_label:
|
||||||
client: true
|
client: true
|
||||||
default: 'Advertiser'
|
default: "Advertiser"
|
||||||
codefund_advertiser_short_label:
|
codefund_advertiser_short_label:
|
||||||
client: true
|
client: true
|
||||||
default: 'Ad'
|
default: "Ad"
|
||||||
codefund_through_trust_level:
|
codefund_through_trust_level:
|
||||||
client: true
|
client: true
|
||||||
default: 2
|
default: 2
|
||||||
enum: 'TrustLevelSetting'
|
enum: "TrustLevelSetting"
|
||||||
codefund_nth_post:
|
codefund_nth_post:
|
||||||
client: true
|
client: true
|
||||||
default: 4
|
default: 4
|
||||||
|
|
17
plugin.rb
17
plugin.rb
|
@ -5,3 +5,20 @@
|
||||||
# url: https://github.com/discourse/discourse-adplugin
|
# url: https://github.com/discourse/discourse-adplugin
|
||||||
|
|
||||||
register_asset "stylesheets/adplugin.scss"
|
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
|
||||||
|
|
Loading…
Reference in New Issue