- Issue created by @altcom_neil
We have migrated to D9 and were having trouble creating redirects from one node to another when the first node was unpublished. In the end we worked out it was because were weren't using the node/NID path instead of the alias as used to work in D7 (as discussed in
https://www.drupal.org/project/redirect/issues/2821158
📌
Document that URL redirects work from node/{nid} but not alias
Needs work
).
This lead to some investigation on how we can improve the UI for our clients when managing redirects from old content to new and we have come up with adding some additional functionality to the URL Redirects section of the node edit page.
After the table where the redirects from a relative URL to the node are displayed is a new button so that a Redirect from this node to another URL can be easily added.
If there are any redirects from this node to another URL these are retrieved using a Drupal\redirect\RedirectRepository::findBySourcePath
call. When there are redirects from this node to somewhere else, both the Add URL Redirect
and new Redirect to another URL
buttons are not displayed.
We don't use content in multiple languages so I would imagine there is more work to do to add support for redirects to different URLs based on the language?
Adds a new button to the URL redirects section:
And if there are redirects from this node to another URL displays them while removing the Add buttons:
I think using the table may or may not be the correct way to go. Possibly if there is just a single redirect then it should be displayed a different way and only use the table if there are multiple redirects for multiple languages?
Active
1.9
Code