Add meta_noindex setting on organizer level

This commit is contained in:
Raphael Michel
2021-06-25 11:26:04 +02:00
parent a856a3ef6f
commit 618b67ca2f
6 changed files with 17 additions and 1 deletions

View File

@@ -298,6 +298,7 @@ class OrganizerSettingsForm(SettingsForm):
'giftcard_expiry_years',
'locales',
'region',
'meta_noindex',
'event_team_provisioning',
'primary_color',
'theme_color_success',

View File

@@ -231,7 +231,10 @@
{% bootstrap_field sform.display_net_prices layout="control" %}
{% bootstrap_field sform.show_variations_expanded layout="control" %}
{% bootstrap_field sform.hide_sold_out layout="control" %}
{% bootstrap_field sform.meta_noindex layout="control" %}
{% url "control:organizer.edit" organizer=request.organizer.slug as org_url %}
{% propagated request.event org_url "meta_noindex" %}
{% bootstrap_field sform.meta_noindex layout="control" %}
{% endpropagated %}
{% if sform.frontpage_subevent_ordering %}
{% bootstrap_field sform.frontpage_subevent_ordering layout="control" %}
{% endif %}

View File

@@ -45,6 +45,7 @@
{% bootstrap_field sform.event_list_type layout="control" %}
{% bootstrap_field sform.event_list_availability layout="control" %}
{% bootstrap_field sform.organizer_link_back layout="control" %}
{% bootstrap_field sform.meta_noindex layout="control" %}
</fieldset>
<fieldset>
<legend>{% trans "Localization" %}</legend>

View File

@@ -7,6 +7,13 @@
{% block thetitle %}
{% block title %}{% endblock %}{% if url_name != "organizer.index" %} :: {% endif %}{{ organizer.name }}
{% endblock %}
{% block custom_header %}
{% if organizer.settings.meta_noindex %}
<meta name="robots" content="noindex, nofollow">
{% endif %}
<meta property="og:type" content="website" />
{{ block.super }}
{% endblock %}
{% block above %}
{% if organizer.settings.locales|length > 1 or request.organizer.settings.customer_accounts %}
{% if organizer.settings.theme_color_background|upper != "#FFFFFF" or organizer.settings.organizer_logo_image_large %}

View File

@@ -635,6 +635,8 @@ class EventIcalDownload(EventViewMixin, View):
resp['Content-Disposition'] = 'attachment; filename="{}-{}-{}.ics"'.format(
event.organizer.slug, event.slug, subevent.pk if subevent else '0',
)
if event.settings.meta_noindex:
resp['X-Robots-Tag'] = 'noindex'
return resp

View File

@@ -765,4 +765,6 @@ class OrganizerIcalDownload(OrganizerViewMixin, View):
resp['Content-Disposition'] = 'attachment; filename="{}.ics"'.format(
request.organizer.slug
)
if request.organizer.settings.meta_noindex:
resp['X-Robots-Tag'] = 'noindex'
return resp