Table of contents

Publishing

Change a slug and create redirect in Whitehall

Change a slug and create redirect in Whitehall

Whitehall

A Rake Tasks exists in Whitehall to quickly change the slug of a Document. It also reindexes the Document with its new slug, republishes the document to Publishing API, which automatically handles the redirect.

The task takes the Document’s old slug and the Document’s new slug.

$ bundle exec 'reslug:document[old_slug,new_slug]'

Jenkins - integration

This rake task also works for Person, Role, PolicyGroup, Organisation, WorldOrganisation and WorldLocation. For example: reslug:world_location[old_slug,new_slug]

Issues

If you run the task and find the redirect has worked, but the new location returns a 404, it’s likely because the republish command is languishing in the low-priority queue (check queue volumes in Grafana. Whitehall appears to put the redirect in the high priority queue, so there can be a delay between the redirect being applied and the content being republished.

This should resolve itself over time, but if you need to process the content change more quickly, run a rake task to put it in the high priority queue:

  • TARGET_APPLICATION: publishing-api
  • MACHINE_CLASS: publishing_api
  • RAKE_TASK: represent_downstream:high_priority:content_id[CONTENT_ID] (for example, represent_downstream:high_priority:content_id[5d63bf56-7631-11e4-a3cb-005056011aef])
This page was last reviewed on 29 April 2019. It needs to be reviewed again on 29 October 2019 by the page owner #govuk-2ndline .
This page was set to be reviewed before 29 October 2019 by the page owner #govuk-2ndline. This might mean the content is out of date.