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>
.
Change the relevant name and slug in the
lib/data/countries.yml
file. Keepcontent_id
andemail_signup_content_id
the same, and ensure the alphabetical order of the list is respected. ExampleDeploy 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
Run Rake tasks
kubectl exec deploy/travel-advice-publisher – rake
* Run country:rename[old_country_slug,new_country_slug]
to update the TravelAdviceEdition
s.
* 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
- 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
andSearch 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:
- Create a pull request with a change to the relevant country taxon in
config/govuk_index/migrated_formats.yaml
- Deploy Search API
In Content Tagger:
- View the taxon from the list
- Under
Tasks
go toEdit taxon
, and update thebase path
,internal taxon name
,external taxon name
and any others with the new country name - 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:
Create a data migration to update the
slug
andname
fields of theWorldLocation
table.Deploy the changes
Run the
db:data:migrate
rake task in WhitehallUpdate World Location News
- Go to the relevant country in World Location News. In the “Details” tab, edit the
Title
,Mission statement
and relevantFeatured links
.
- Go to the relevant country in World Location News. In the “Details” tab, edit the
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 bywhitehall
. So do this after deploying the Whitehall change.
This will update content from pages served by smart-answers
such as:
In Smart-answers:
Create a pull request that replaces all instances of
country_name
withnew_country_name
.Check changes are reflected in the affected smart answers
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.
- 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 - 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
Create and deploy pull requests for schemas in publishing api (example) and Specialist Publisher (example) to support both countries temporarily (during the data migration).
Run the rake task
publishing_api:publish_finder[finder]
to republish the updated finders:export_health_certificates
international_development_funds
Run the rake task
rename_country:all[country_slug,new_country_slug]
to republish all the relevant documents.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.
Create and deploy another pull request for content schemas in publishing api (example) and Specialist Publisher (example) to remove support for the old country.
Re-publish the finders again, as above.
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