FEATURE: new setting to disable ads based on tags
Enter a list of tags in the new setting no_ads_for_tags to prevent ads from being rendered on topics with one or more of those tags, and on topic list pages for those tags.
This commit is contained in:
parent
574500ba08
commit
31efc7025d
|
@ -13,6 +13,21 @@ export default Ember.Component.extend({
|
|||
"router.currentRoute.parent.attributes.category.slug"
|
||||
),
|
||||
|
||||
@computed(
|
||||
"router.currentRoute.parent.attributes.tags",
|
||||
"router.currentRoute.attributes.__type",
|
||||
"router.currentRoute.attributes.id"
|
||||
)
|
||||
currentTags(tagsArray, type, tag) {
|
||||
if (tagsArray) {
|
||||
return tagsArray;
|
||||
}
|
||||
|
||||
if (type == "tag" && tag) {
|
||||
return [tag];
|
||||
}
|
||||
},
|
||||
|
||||
@computed("currentUser.groups")
|
||||
showToGroups(groups) {
|
||||
const currentUser = Discourse.User.current();
|
||||
|
@ -34,14 +49,21 @@ export default Ember.Component.extend({
|
|||
return !groupNames.any(g => noAdsGroupNames.includes(g));
|
||||
},
|
||||
|
||||
@computed("currentCategoryId")
|
||||
showOnCurrentPage(categoryId) {
|
||||
@computed("currentCategoryId", "currentTags")
|
||||
showOnCurrentPage(categoryId, currentTags) {
|
||||
return (
|
||||
!categoryId ||
|
||||
!this.siteSettings.no_ads_for_categories ||
|
||||
!this.siteSettings.no_ads_for_categories
|
||||
.split("|")
|
||||
.includes(categoryId.toString())
|
||||
(!categoryId ||
|
||||
!this.siteSettings.no_ads_for_categories ||
|
||||
!this.siteSettings.no_ads_for_categories
|
||||
.split("|")
|
||||
.includes(categoryId.toString())) &&
|
||||
(!currentTags ||
|
||||
!this.siteSettings.no_ads_for_tags ||
|
||||
Ember.isEmpty(
|
||||
this.siteSettings.no_ads_for_tags
|
||||
.split("|")
|
||||
.filter(tag => currentTags.includes(tag))
|
||||
))
|
||||
);
|
||||
},
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ en:
|
|||
site_settings:
|
||||
no_ads_for_groups: "Don't show ads to users in these groups."
|
||||
no_ads_for_categories: "Don't show ads on topic list and topic pages belonging to these categories."
|
||||
no_ads_for_tags: "Don't show ads on topic list and topic pages belonging to these tags."
|
||||
house_ads_after_nth_post: 'If "Between posts" house ads are defined, show an ad after every N posts, where N is this value.'
|
||||
house_ads_frequency: "If other ad networks are configured to show in an ad slot, how often should house ads be shown, as a percentage."
|
||||
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>."
|
||||
|
|
|
@ -7,6 +7,10 @@ ad_plugin:
|
|||
client: true
|
||||
default: ""
|
||||
type: category_list
|
||||
no_ads_for_tags:
|
||||
client: true
|
||||
default: ""
|
||||
type: list
|
||||
house_ads_after_nth_post:
|
||||
client: true
|
||||
default: 20
|
||||
|
|
Loading…
Reference in New Issue