diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html
new file mode 100644
index 000000000..66f450931
--- /dev/null
+++ b/docs/_templates/layout.html
@@ -0,0 +1,16 @@
+{% extends "!layout.html" %}
+
+{% block document %}
+
+ {% if current_version.name == "develop" %}
+
+ {% endif %}
+
+{{ super() }}
+
+{% endblock %}
diff --git a/docs/_templates/versions.html b/docs/_templates/versions.html
new file mode 100644
index 000000000..5f38020b9
--- /dev/null
+++ b/docs/_templates/versions.html
@@ -0,0 +1,19 @@
+{%- if current_version %}
+
+
+ Other Versions
+ {{ current_version.name }}
+
+
+
+ {%- if versions.branches %}
+
+ - Versions
+ {%- for item in versions.branches %}
+ - {{ item.name }}
+ {%- endfor %}
+
+ {%- endif %}
+
+
+{%- endif %}
diff --git a/docs/build_docs.sh b/docs/build_docs.sh
index 6a3354496..4fb40928f 100755
--- a/docs/build_docs.sh
+++ b/docs/build_docs.sh
@@ -1,6 +1,6 @@
#!/bin/bash -eux
# Building sphinx and swagger docs
-python -m sphinx . $BUILD_PATH
+poetry run sphinx-multiversion . $BUILD_PATH
TARGET_PATH="$BUILD_PATH/swagger" ./build_swagger.sh
python ./get-releases-json.py > $BUILD_PATH/releases.json
python ./get-releases-json.py --latest > $BUILD_PATH/latest.txt
diff --git a/docs/conf.py b/docs/conf.py
index 355eea6d5..7ba31a7b4 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -20,7 +20,7 @@
import os
import sys
import datetime
-from shutil import copyfile
+import subprocess
sys.path.insert(0, os.path.abspath("../api"))
sys.path.insert(0, os.path.abspath("../api/config"))
@@ -46,8 +46,20 @@ for key, value in FUNKWHALE_CONFIG.items():
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
-extensions = ["sphinx.ext.graphviz", "sphinx.ext.autodoc"]
-autodoc_mock_imports = ["celery", "django_auth_ldap", "ldap", "persisting_theory", "rest_framework"]
+extensions = [
+ "sphinx.ext.graphviz",
+ "sphinx.ext.autodoc",
+ "myst_parser",
+ "sphinx_panels",
+ "sphinx_multiversion",
+]
+autodoc_mock_imports = [
+ "celery",
+ "django_auth_ldap",
+ "ldap",
+ "persisting_theory",
+ "rest_framework",
+]
add_module_names = False
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
@@ -72,10 +84,7 @@ author = "The Funkwhale Collective"
# built documents.
#
# The short X.Y version.
-version = funkwhale_api.__version__
-if "-dev" in version:
- version = "develop"
-# The full version, including alpha/beta/rc tags.
+version = subprocess.check_output(["git", "describe", "--tags"]).strip().decode("utf-8")
release = version
# The language for content autogenerated by Sphinx. Refer to documentation
@@ -230,3 +239,7 @@ def copy_legacy_redirects(app, docname):
def setup(app):
app.connect("build-finished", copy_legacy_redirects)
+
+
+smv_tag_whitelist = None
+smv_branch_whitelist = r"(stable|develop)$"