Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Merge requests
  • !37655

Keep context when navigating from v5.0/v5.1 to v5.2

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Julien Déramond requested to merge gh-pages-jd-keep-context-between-v5-version-switch into gh-pages Dec 15, 2022
  • Overview 2
  • Commits 1
  • Pipelines 0
  • Changes 193

Related issues

Closes #37643 (closed)

Description

This PR suggests to modify docs/v5.0 and docs/v5.1 to keep the context of navigation when going from v5.0/v5.1 to v5.2. Going from v5.2 to v5.1/v5.2 is already in place.

Used the following script to modify everything (not a good quality one but worked pretty well). Put it here, can be useful for future selves.

#!/bin/bash

echo "toto"

for file in `find docs/5.0 -name "index.html" -type f`
do
  # echo $file

  # Get path (e.g. /about/brand)
  test=`echo $file | tail -c +9`
  path=`echo $test | rev | cut -c 11- | rev`

  # Filter the files we want to modify
  toto=`cat $file | grep "<a class=\"dropdown-item\" href=\"https://getbootstrap.com/docs/5.2/\">"`
  if [[ $toto ]]
  then
    ttt=`echo $path | sed 's/\//\\\\\//g'`
    echo $ttt

    # First modification
    sed 's/<a class="dropdown-item" href="https:\/\/getbootstrap.com\/docs\/5.2\/">/<a class="dropdown-item" href="https:\/\/getbootstrap.com\/docs\/5.2'${ttt}'">/g' $file > $file.out
    mv $file.out $file

    # Second modification
    sed 's/<a class="dropdown-item" href="https:\/\/getbootstrap.com\/docs\/5.1\/">v5.1.x<\/a>/<a class="dropdown-item" href="https:\/\/getbootstrap.com\/docs\/5.1'${ttt}'">v5.1.3<\/a>/g' $file > $file.out
    mv $file.out $file

    # Third modification
    sed 's/<a class="dropdown-item current" aria-current="true" href="\/docs\/5.0\/">v5.0.x<\/a>/<a class="dropdown-item current" aria-current="true" href="\/docs\/5.0'${ttt}'">v5.0.2<\/a>/g' $file > $file.out
    mv $file.out $file
  fi
done

for file in `find docs/5.1 -name "index.html" -type f`
do
  # echo $file

  # Get path /about/brand for example
  test=`echo $file | tail -c +9`
  path=`echo $test | rev | cut -c 11- | rev`

  # Filter the files we want to modify
  toto=`cat $file | grep "<a class=\"dropdown-item\" href=\"https://getbootstrap.com/docs/5.2/\">"`
  if [[ $toto ]]
  then
    ttt=`echo $path | sed 's/\//\\\\\//g'`
    echo $ttt

    # First modification
    sed 's/<a class="dropdown-item" href="https:\/\/getbootstrap.com\/docs\/5.2\/">/<a class="dropdown-item" href="https:\/\/getbootstrap.com\/docs\/5.2'${ttt}'">/g' $file > $file.out
    mv $file.out $file

    # Second modification
    sed 's/<a class="dropdown-item current" aria-current="true" href="\/docs\/5.1\/">v5.1.x<\/a>/<a class="dropdown-item current" aria-current="true" href="\/docs\/5.1'${ttt}'">v5.1.3<\/a>/g' $file > $file.out
    mv $file.out $file

    # Third modification
    sed 's/<a class="dropdown-item" href="https:\/\/getbootstrap.com\/docs\/5.0\/">v5.0.x<\/a>/<a class="dropdown-item" href="https:\/\/getbootstrap.com\/docs\/5.0'${ttt}'">v5.0.2<\/a>/g' $file > $file.out
    mv $file.out $file
  fi
done

Motivation & Context

This modification could be very helpful for folks arriving from search engines results where, we know it, Bootstrap is not always referenced with the latest version (more details in the issue).

Type of changes

  • Enhancement

Checklist

  • I have read the contributing guidelines
  • My code follows the code style of the project (using npm run lint)
  • My change introduces changes to the documentation
  • I have updated the documentation accordingly
  • All new and existing tests passed
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: gh-pages-jd-keep-context-between-v5-version-switch