# How did CMake Documentation deal with its Version Switcher before v3.9.0?

**URL:** https://discourse.cmake.org/t/how-did-cmake-documentation-deal-with-its-version-switcher-before-v3-9-0/8490
**Category:** Development
**Created:** [July 11, 2023, 7:39am UTC](https://discourse.cmake.org/t/how-did-cmake-documentation-deal-with-its-version-switcher-before-v3-9-0/8490 "2023-07-11T07:39:12Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![hwhsu1231](https://discourse.cmake.org/user_avatar/discourse.cmake.org/hwhsu1231/32/5358_2.png) [@hwhsu1231](https://discourse.cmake.org/u/hwhsu1231)
#### Post date: [July 11, 2023, 7:39am UTC](https://discourse.cmake.org/t/how-did-cmake-documentation-deal-with-its-version-switcher-before-v3-9-0/8490/1 "2023-07-11T07:39:12Z")

</div>

Hello CMake Team.

According to this [topic](https://discourse.cmake.org/t/doc-versioning-mechanism/4814/3), the mechanism of adding the Version Switcher into CMake Documentation is to pass `-A versionswitch=1` to Sphinx flag. Therefore, we can see the following codes in the [Utilities/Sphinx/templates/layout.html](https://gitlab.kitware.com/cmake/cmake/-/blob/v3.22.1/Utilities/Sphinx/templates/layout.html#L20-25):

```auto
{% block extrahead %}
  {% if versionswitch is defined %}
  <script type="text/javascript" src="{{ pathto('../version_switch.js', 1) }}"></script>
  {% endif %}
{{ super() }}
{% endblock %}

```

However, I noticed that there isn’t such codes in the [Utilities/Sphinx/templates/layout.html](https://gitlab.kitware.com/cmake/cmake/-/blob/v3.8.2/Utilities/Sphinx/templates/layout.html) before v3.9.0 (for example, v3.8.2).

> **Click to expand**
>
> ```auto
> {% extends "!layout.html" %}
> {% block rootrellink %}
> <li>
> <img src="{{ pathto('_static/cmake-logo-16.png', 1) }}" alt=""
> style="vertical-align: middle; margin-top: -2px" />
> </li>
> <li>
> <a href="https://cmake.org/">CMake</a>{{ reldelim1 }}
> </li>
> <li>
> <a href="{{ pathto(master_doc) }}">{{ shorttitle|e }}</a>{{ reldelim1 }}
> </li>
> {% endblock %}
> 
> {# Put some context in the html title element. Workaround for #}
> {# https://bitbucket.org/birkenfeld/sphinx/issue/1492/qthelp-generate-html-title-element-should #}
> {% block htmltitle %}
> <title>{{ title|striptags|e }} {{ "&mdash;"|safe }} {{ docstitle|e }}</title>
> {% endblock %}
> 
> ```

Therefore, I wonder how did CMake Documentation deal with its Version Switcher before v3.9.0?

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [July 11, 2023, 4:08pm UTC](https://discourse.cmake.org/t/how-did-cmake-documentation-deal-with-its-version-switcher-before-v3-9-0/8490/2 "2023-07-11T16:08:13Z")

</div>

We manually added the version switch retroactively in a local/unpublished branch of each older version, and regenerated it as a one-shot update to the docs published on `cmake.org`.
