diff --git a/doc/utils/sphinx-config/_themes/lammps_theme/layout.html b/doc/utils/sphinx-config/_themes/lammps_theme/layout.html
index 845f213a4c..1dad9ec4a9 100644
--- a/doc/utils/sphinx-config/_themes/lammps_theme/layout.html
+++ b/doc/utils/sphinx-config/_themes/lammps_theme/layout.html
@@ -138,10 +138,6 @@
{% if READTHEDOCS and current_version %}
{%- set nav_version = current_version %}
{% endif %}
- {% if nav_version %}
-
Version: {{ nav_version }}
- git info: {{ release }}
- {% endif %}
{% endif %}
{% include "searchbox.html" %}
diff --git a/doc/utils/sphinx-config/_themes/lammps_theme/versions.html b/doc/utils/sphinx-config/_themes/lammps_theme/versions.html
index 7368659c43..f0ec4fea1a 100644
--- a/doc/utils/sphinx-config/_themes/lammps_theme/versions.html
+++ b/doc/utils/sphinx-config/_themes/lammps_theme/versions.html
@@ -1,9 +1,9 @@
-{% if READTHEDOCS %}
+{% if READTHEDOCS or display_manual_versions %}
{# Add rst-badge after rst-versions for small badge style. #}
- Read the Docs
- v: {{ current_version }}
+ Version
+ {{ current_version }}
diff --git a/doc/utils/sphinx-config/conf.py.in b/doc/utils/sphinx-config/conf.py.in
index 17cb3c2395..8d3c88e727 100644
--- a/doc/utils/sphinx-config/conf.py.in
+++ b/doc/utils/sphinx-config/conf.py.in
@@ -99,6 +99,16 @@ def get_git_info():
pass
return git_n_date
+def get_git_commit():
+ import subprocess,time
+ try:
+ commit = subprocess.run(['git','rev-parse','HEAD'],stdout=subprocess.PIPE,stderr=subprocess.PIPE)
+ if commit.returncode == 0:
+ return commit.stdout.decode()
+ except:
+ pass
+ return ''
+
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
@@ -108,6 +118,8 @@ version = get_lammps_version()
# The full version, including alpha/beta/rc tags.
release = get_git_info()
+git_commit = get_git_commit()
+
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
@@ -389,3 +401,18 @@ breathe_domain_by_extension = { 'h' : 'cpp',
'cpp' : 'cpp',
'c' : 'c',
}
+
+# allows showing multiple versions
+try:
+ html_context
+except NameError:
+ html_context = dict()
+
+html_context['display_manual_versions'] = True
+html_context['current_version'] = version
+html_context['git_commit'] = git_commit
+html_context['versions'] = [
+ ('latest', 'https://docs.lammps.org/'),
+ ('8 Apr 2021', 'https://lammps.sandia.gov/doc/')
+]
+html_context['downloads'] = [('PDF', 'Manual.pdf')]