add "noindex, nofollow" HTML robots meta-tag to documentation pages

- Customize the "readthedocs" mkdocs theme: https://www.mkdocs.org/user-guide/styling-your-docs/#customizing-a-theme
 - Adds a '<meta name="robots" content="noindex, nofollow">' HTML tag on each page
 - Do not include robots directive on readthedocs.org, only in local builds
This commit is contained in:
nodiscc 2018-08-30 19:36:22 +02:00
parent f28b73b21f
commit 2b4f391559
2 changed files with 28 additions and 1 deletions

View file

@ -0,0 +1,25 @@
{% extends "base.html" %}
{#
The entry point for the ReadTheDocs Theme.
Any theme customisations should override this file to redefine blocks defined in
the various templates. The custom theme should only need to define a main.html
which `{% extends "base.html" %}` and defines various blocks which will replace
the blocks defined in base.html and its included child templates.
#}
{%- block site_meta %}
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{%- if 'media.readthedocs.org' not in config.extra_css[0] %}
<meta name="robots" content="noindex, nofollow">
{%- endif %}
{% if page and page.is_homepage %}<meta name="description" content="{{ config.site_description }}">{% endif %}
{% if config.site_author %}<meta name="author" content="{{ config.site_author }}">{% endif %}
{% if config.site_favicon %}<link rel="shortcut icon" href="{{ config.site_favicon|url }}">
{% else %}<link rel="shortcut icon" href="{{ 'img/favicon.ico'|url }}">{% endif %}
{%- endblock %}

View file

@ -2,7 +2,9 @@ site_name: Shaarli Documentation
repo_url: https://github.com/shaarli/Shaarli repo_url: https://github.com/shaarli/Shaarli
edit_uri: edit/master/doc/md edit_uri: edit/master/doc/md
site_description: The personal, minimalist, super-fast, database free, bookmarking service site_description: The personal, minimalist, super-fast, database free, bookmarking service
theme: readthedocs theme:
name: readthedocs
custom_dir: doc/custom_theme/
docs_dir: doc/md docs_dir: doc/md
site_dir: doc/html site_dir: doc/html
# Disable strict mode until ReadTheDocs provides up-to-date MkDocs settings: # Disable strict mode until ReadTheDocs provides up-to-date MkDocs settings: