You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A commonly requested feature for Wagtail is automatically creating redirects to pages on certain events such as moving, changing slug, and deleting a page.
4
-
5
-
This RFC contains a proposal to add this feature into Wagtail.
3
+
This RFC contains a proposal to implement automatic creation of redirects and a couple of improvements to managing redirects in the admin interface.
6
4
7
5
## Motivation
8
6
@@ -12,30 +10,59 @@ This is a highly undesirable outcome as links to those pages would be broken, an
12
10
13
11
In order to prevent this from happening, editors must manually create redirects for pages that they move or change the slug of on their site, and repeat this for any child pages. This could be a tedious task and may be forgotten.
14
12
15
-
This is a task that can be quite easily handled by Wagtail. We just need to add a user interface to allow a user to specify if they want redirects to be created on moving pages or changing slugs and Wagtail can do the rest of the work.
13
+
This is a task that can be done automatically by Wagtail.
14
+
15
+
## Prior art
16
+
17
+
The [``wagtail-automatic-redirects``](https://github.com/themotleyfool/wagtail-automatic-redirects/) package, created by The Motley Fool, currently provides the "[Automatic creation of redirects when pages URL changes](#automatic-creation-of-redirects-when-pages-url-changes)" feature in an installable package.
16
18
17
19
## Specification
18
20
19
-
We will implement automatic creation of redirects in the following places. Note that users must have permission to add redirects in order for any of these interfaces to appear.
### Automatic creation of redirects on page deletion
26
50
27
-
If this is checked, a redirect to the page will be created from the previous URL of the page. Redirects are also created for all descendants of the page.
51
+
When the feature is enabled, a new page chooser field (optional) would be displayed on the "delete page confirm" view.
52
+
This allows users to pick a destination page to redirect any users visiting the old URLs to.
28
53
29
-
### On page slug change
54
+
If they are deleting a tree, a redirect will be created for every page in the tree, but they will all point to the same destination.
30
55
31
-
When a page’s slug is changed, a checkbox will appear underneath the slug field asking the user if they would like to create a redirect from the old slug.
56
+
### Redirects listing filters
32
57
33
-
If this is checked, a redirect to the page will be created from the previous URL of the page. Redirects are also created for all descendants.
58
+
The redirects listing would now include three new filters on the right hand side:
34
59
35
-
Note that if the page is saved in draft, the redirects are still created but they won't take effect until the slug change is published since redirects only work if there is not already a page at the URL.
60
+
- "Redirect type" (Choice) - Filters the redirects listing by redirect type (All / Internal / External)
61
+
- "Page" (Page chooser) - When a page is chosen, the redirects will be filtered to include only those that point at the chosen page
62
+
- "Hide automatically created redirects" (Checkbox) - When checked, any redirects that were automatically created (and not subsequently edited later) would be hidden
36
63
37
-
### When unpublishing or deleting a page
64
+
### Redirects panel on promote tab
38
65
39
-
When unpublishing or deleting a page or page tree, the user will be given the option to add redirects to a page. This will also update any existing redirects pointing at the page being deleted.
66
+
On the promote tab on all pages, we will display the number of redirects that link to the page. This number would be a link to the redirects listing filtered to the current page.
40
67
41
-
Note that if the user is deleting a page tree, the user will only be able to choose a single destination page for all the redirects that get created.
68
+
This is only displayed to users who have permission to see the redirects listing.
0 commit comments