Skip to content

Migrate tabs to shortcode format

Sarah German requested to merge 15-tabs-migration into main

What does this MR do and why?

  • Adds a script to migrate Tabs to shortcode format (old format vs new format)
  • Fixes the shortcode for handling for images within tabs. Pages with images inside tabs were throwing errors on build.
    • This was because images rendered within a shortcode have different context than images rendered at the page level.
  • Adds a script to detect tabs that are nested 2+ levels deep. These are not working in Hugo (see #87). At some point we'll need to either make these work or manually refactor the content to not do this.

Screenshots, screen recordings, or links to review app

Before After
image image

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Checkout this branch: git fetch origin 15-tabs-migration && git checkout 15-tabs-migration
  2. Run this new migration alone:
      1. Re-clone content, but don't run any migrations yet: REMOVE_BEFORE_CLONE=true go run cmd/gldocs/main.go clone
      1. Run just this migration, on just the gitlab docs: go run cmd/gldocs/main.go migrate tabs ../gitlab/doc
      1. Take a look at the diff, and verify the changes look OK (no need to review the entire diff, just scroll through some of it): git -C ../gitlab diff

In the diff, you should see content is transformed from the old tabs format to the new tabs format, without any other changes.

Next, test a full build:

  1. Run a new clone, with the normal full migration: REMOVE_BEFORE_CLONE=true make clone-docs-projects
  2. Run the local site: make view
  3. Visit a few pages with Tabs. They should now render as functional tabs. Some examples:
  1. Test out the script for detecting nested tabs: ./scripts/nested-tabs.sh (this also runs on the pipeline)

The script should find ~4 pages that have nested tabs.

Merge request acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Closes #15 (closed)

Edited by Hiru Fernando

Merge request reports