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

Create a redirect view for future releases not set up on the site yet #306

Closed
Tracked by #305
thibaudcolas opened this issue May 3, 2023 · 4 comments · Fixed by #375
Closed
Tracked by #305

Create a redirect view for future releases not set up on the site yet #306

thibaudcolas opened this issue May 3, 2023 · 4 comments · Fixed by #375
Assignees

Comments

@thibaudcolas
Copy link
Member

thibaudcolas commented May 3, 2023

There are two links from the CMS to this website that it would be nice to future-proof with a view / middleware that automates redirects, or a custom 404 page set up accordingly.

Release notes links

For links to "New in Wagtail x.y" - https://guide.wagtail.org/en-4.2.x/releases/new-in-wagtail-4-2/. Currently the CMS defaults to targeting a manually created redirect, https://guide.wagtail.org/en-latest/releases/latest/, which we then update in the guide.wagtail.org admin.

Instead, we could set up links like for docs.wagtail.org:

"https://docs.wagtail.org/en/v%s" % __version__

and make sure any version of the guide that doesn’t yet exist is handled gracefully.

Guide homepage links

We currently link to https://guide.wagtail.org/ which redirects to latest. It’d again be nicer if we linked straight to a specific version based on the version of the CMS, and gracefully handled versions that don’t exist yet.


I expect as part of changing this we will also be able to fix wagtail/wagtail#10105. Edit: done

@sheepman4267
Copy link

The existence of this issue makes sense of what I just noticed, which is that the "latest" redirect is still going to "what's new in Wagtail 4.2", while the link text in the CMS now reads "what's new in Wagtail 5.0" now that I've updated my project :)

@thibaudcolas
Copy link
Member Author

Thanks for reporting @sheepman4267! I thought I had updated the redirects but I had missed this one. All the more reason to automate this even if this is simple to do manually.

@thibaudcolas
Copy link
Member Author

thibaudcolas commented Oct 30, 2023

  • Case one: Release page already exists: user should view the release page (ideally without a redirect, just have the link match the existing link to those release pages)
  • Case two: Release page doesn’t exist: user should view a 404 that says "this release doesn’t exist. [Link to latest release’s release notes]"

(Possibly to consider in the future always-on redirect view that takes people to the latest release’s release notes (/latest-release)


In the CMS: https://github.com/wagtail/wagtail/blob/568e7ae2f28a72a792ea23892ea02f1ac5c54b5e/wagtail/templatetags/wagtailcore_tags.py#L85-L101

Release notes link

@register.simple_tag
def wagtail_feature_release_whats_new_link():
    major, minor, patch, release, num = VERSION
	if release == "final":
        return f"https://guide.wagtail.org/en-{major}.{minor}.x/releases/new-in-wagtail-{major}-{minor}/"
	return "magic view that always links to the latest release or existing Wagtail redirect https://guide.wagtail.org/en-latest/releases/latest/"

Homepage link

https://github.com/wagtail/wagtail/blob/568e7ae2f28a72a792ea23892ea02f1ac5c54b5e/wagtail/templatetags/wagtailcore_tags.py#L104-L106

@register.simple_tag
def wagtail_feature_release_editor_guide_link():
    major, minor, patch, release, num = VERSION
	if release == "final":
        return f"https://guide.wagtail.org/en-{major}.{minor}.x/"
    return "https://guide.wagtail.org/"

@thibaudcolas
Copy link
Member Author

Fixed in #375. See also wagtail/wagtail#11182.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants