 <div class="row">
    <div class="dropdown mb-2">
        {% if site.versioning %}
            <button class="btn btn-primary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
            {{ page.version }}
            </button>
            <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
            {% assign original_version = page.version | prepend: '/' | append: '/' %}
            {% assign latest_url = page.url | replace: page.version, site.latest | relative_url %}
            
            {% for version in site.versions %}
            {% assign new_version = version | prepend: '/' | append: '/' %}
            <a class="dropdown-item" href="{{ page.url | replace: original_version, new_version | relative_url }}">{{ version }}</a>
            {% endfor %}
            </div>
        {% else %}
            <span>{{ site.latest }}</span>
        {% endif %}
    </div>
</div>