Skip to main content
Last updated: 7 Oct 2024

Rename a country

Note

We recommend you test out these instructions in integration and then staging before using them in production.

Renaming a country affects these pages:

  • https://www.gov.uk/export-health-certificates (country filter)
  • https://www.gov.uk/international-development-funding (country filter)
  • https://www.gov.uk/foreign-travel-advice/<country_slug>
  • https://www.gov.uk/world/<country_slug>
  • https://www.gov.uk/world/<country_slug>/news
  • https://www.gov.uk/foreign-travel-advice/<country_slug>/email-signup/
  • https://www.gov.uk/email/subscriptions/new?topic_id=<country_slug>

1. Update Travel Advice Publisher

This will update www.gov.uk/foreign-travel-advice/<country_slug> to www.gov.uk/foreign-travel-advice/<new_country_slug>.

  1. Change the relevant name and slug in the lib/data/countries.yml file. Keep content_id and email_signup_content_id the same, and ensure the alphabetical order of the list is respected. Example

  2. Deploy Travel Advice Publisher

    • Once the above pull request is ready, deploy Travel Advice Publisher to update the countries YAML file.
    • You will see the country has updated in the list in Travel Advice Publisher
  3. Run Rake tasks

kubectl exec deploy/travel-advice-publisher – rake * Run country:rename[old_country_slug,new_country_slug] to update the TravelAdviceEditions. * Run publishing_api:republish_edition[new_country_slug] to update the Publishing API. * Run publishing_api:republish_email_signups:country_edition[country-slug] to update email subscriptions at /foreign-travel-advice/<country_slug>/email-signup

  1. Update the search metadata
    • In the UI, go to the country and create a new edition
    • Tick the “minor update” checkbox and update the Search title and Search description fields with the updated country name.
    • Save and publish.

2. Update Worldwide Taxons

Example pull request: https://github.com/alphagov/search-api/pull/2884/files

This will update www.gov.uk/world/<country_slug> to www.gov.uk/world/<new_country_slug>.

In Search API:

  1. Create a pull request with a change to the relevant country taxon in config/govuk_index/migrated_formats.yaml
  2. Deploy Search API

In Content Tagger:

  1. View the taxon from the list
  2. Under Tasks go to Edit taxon, and update the base path, internal taxon name, external taxon name and any others with the new country name
  3. Save the draft and publish.

The old slug might still appear as a duplicate in our internal GOV.UK search,

Note

Updating the child taxons linked to the country taxon (“UK help and services in country”) will be a content task.

3. Update Whitehall

Example pull request: https://github.com/alphagov/whitehall/pull/8963

This will update www.gov.uk/world/<country_slug>/news.

In Whitehall:

  1. Create a data migration to update the slug and name fields of the WorldLocation table.

  2. Deploy the changes

  3. Run the db:data:migrate rake task in Whitehall

  4. Update World Location News

    • Go to the relevant country in World Location News. In the “Details” tab, edit the Title, Mission statement and relevant Featured links.

4. Update Smart-answers

Example pull request: https://github.com/alphagov/smart-answers/pull/6755

Note

smart-answers validates country names against the production worldwide API, which is managed by whitehall. So do this after deploying the Whitehall change.

This will update content from pages served by smart-answers such as:

In Smart-answers:

  1. Create a pull request that replaces all instances of country_name with new_country_name.

  2. Check changes are reflected in the affected smart answers

  3. Deploy the pull request

5. Update Email Alert API

The country may have associated subscriber lists, such as:

  • “Publications related to <country_name>
  • <country_name> - travel advice”
  • <country_name>

The titles of these lists will update automatically the next time a user tries to subscribe. You can force this to happen sooner by pretending to subscribe yourself (just to the point where you select a frequency).

Each subscriber list also has a “slug”, which appears in the query params of the last few pages of the signup journey (selecting a frequency and entering an email). You can reset the slug manually as follows:

WARNING: the slug is used as an ID for the last few pages of the signup journey (e.g. here). When you change the slug, any users currently trying to sign up on the pages will receive a 404.

  1. Run the rake task data_migration:find_subscriber_list_by_title[title] with the country name to see which subscription lists need to be updated
  2. Run the rake task data_migration:update_subscriber_list_slug[slug,new_slug] to update the subscription lists

6. Remove duplicate search results

In Whitehall run SearchIndexDeleteWorker.perform_async(link, index)

For example SearchIndexDeleteWorker.perform_async('/world/micronesia/news', 'government')

7. Update Specialist Publisher

  1. Create and deploy pull requests for schemas in publishing api (example) and Specialist Publisher (example) to support both countries temporarily (during the data migration).

  2. Run the rake task publishing_api:publish_finder[finder] to republish the updated finders:

    • export_health_certificates
    • international_development_funds
  3. Run the rake task rename_country:all[country_slug,new_country_slug] to republish all the relevant documents.

  4. Check the country filter options have updated and documents appear with the new country filter set. This could take a few minutes due to the time it takes to republish the finder and all its associated documents.

  5. Create and deploy another pull request for content schemas in publishing api (example) and Specialist Publisher (example) to remove support for the old country.

  6. Re-publish the finders again, as above.

  7. Run the rake task data_migration:update_subscriber_list_tag[field,country_slug,new_country_slug] to update the matching criteria for any subscriber lists in Email Alert API with keys of:

    • location
    • destination_country