Skip to content

Versioning - Pre-Release Banner #5803

Answered by adam-moss
adam-moss asked this question in Q&A
Discussion options

You must be logged in to vote

I've just had a chance to play with this and have come up with a fairly clean solution I think.

In mkdocs.yml, add an extra attribute that is passed into the jinja2 template via mkdocs itself:

extra:
  pre_release: true

In overrides/main.html, use the passed variable in a conditional surrounding the announce block:

{% extends "base.html" %}

{% if config.extra.pre_release %}
  {% block announce %}
    You are currently viewing <strong>pre-release</strong> documentation.  This may contain features that have not yet been packaged. For the most accurate information, please <strong><a href="{{ '../' ~ base_url }}">access the release version</a></strong>.
  {% endblock %}
{% endif %}

{% block o…

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@adam-moss
Comment options

@adam-moss
Comment options

Answer selected by adam-moss
@squidfunk
Comment options

@AdrianoKF
Comment options

@squidfunk
Comment options

@AdrianoKF
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants