Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RedirectBundle] Automatically generate redirects #2831

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

JZuidema
Copy link
Contributor

@JZuidema JZuidema commented Nov 10, 2020

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Fixed tickets

When the slug of a page is changed, if you visit the old url it will result in a 404. This feature will allow Kunstmaan to automatically generate a redirect for each page that implements the AutoRedirectInterface

When a slug is changed, the subscriber performs these steps:

  • Find all redirects with origin the newly created url. Delete these redirects. (because it is going to be an actual url, you don't need to have an existing redirect for it
  • Find all redirects with target the old url. Update the target to the newly created url. (so you don't have to chain redirects going from A to B to C to D, but instead going from A to D and from B to D)
  • Create a new redirect with origin the old url and target the newly created url.

Here is an example:

This is the current page:
afbeelding

We rename the page to Page B and change the slug accordingly:
afbeelding

We now have one automatically generated redirect:
afbeelding

We rename the page to Page C and change the slug accordingly:
afbeelding

We now have two automatically generated redirects. Both redirects now target /page-c (instead of page-a redirecting to page-b etc)
afbeelding

We regret all the name changes, and rename the page back to Page A and change the slug accordingly:
afbeelding

We now still have to redirects where page-b and page-c both redirect back to page-a
afbeelding

@ProfessorKuma ProfessorKuma added this to the 5.8.0 milestone Nov 10, 2020
Copy link

@ProfessorKuma ProfessorKuma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @, your PR needs some changes

  • This PR seems to need a milestone of a minor release.

Copy link

@ProfessorKuma ProfessorKuma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @, your PR passed all our requirements.

Thank you for contributing!

@acrobat acrobat modified the milestones: 5.8.0, 5.9.0 Mar 17, 2021
@acrobat acrobat self-assigned this Jun 4, 2021
@acrobat
Copy link
Member

acrobat commented Jun 4, 2021

@JZuidema I'm thinking if we need the marker interface at all, would it make sense to have a configuration option in the node bundle to activitate auto redirects for all cms pages?

@acrobat acrobat modified the milestones: 5.9.0, 5.10.0 Oct 10, 2021
@acrobat
Copy link
Member

acrobat commented Oct 12, 2021

I temporary removed the milestone as this needs some work. I've recently also implemented this in project and one thing missing here is the implementation of the multidomain setup. If you have multiple domains these need be added only for the specific domain.

So let's see in 6.x to implement this feature, I will see what I can add from my custom implementation!

@acrobat acrobat removed this from the 5.10.0 milestone Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants