Closed hancush closed 2 years ago
templates/{{ cookiecutter.module_name }}
settings.py
if os.getenv('DJANGO_ALLOW_SEARCH_INDEXING', False) == 'True': ALLOW_SEARCH_INDEXING = True else: ALLOW_SEARCH_INDEXING = False
context_processors.py
from django.conf import settings def base_context(request): return { 'allow_index': settings.ALLOW_SEARCH_INDEXING }
base.html
<meta name="robots" content="{% if allow_index %}all{% else %}noindex{% endif %}"> {% if allow_index %} <link rel="canonical" href="${FILL IN PRODUCTION DOMAIN WITH NO TRAILING SLASH HERE}{{ request.path }}" /> {% endif %}
<meta property="og:title" content="{{ page.title }}"> <meta property="og:url" content="{{ request.build_absolute_uri }}"> <meta property="og:image" content="{{ request.scheme }}://{{ request.get_host }}${ADD THE STATIC TAG WITH THE PATH TO YOUR SHARE CARD HERE}"> <!-- Twitter metadata --> <meta name="twitter:card" content="summary_large_image"> <meta name="twitter:title" content="{{ page.title }}"> <meta name="twitter:url" content="{{ request.build_absolute_uri }}"> <meta name="twitter:image" content="{{ request.scheme }}://{{ request.get_host }}${ADD THE STATIC TAG WITH THE PATH TO YOUR SHARE CARD HERE}">
Documentation request
templates/{{ cookiecutter.module_name }}
to the template directories.settings.py
context_processors.py
base.html
base.html