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

Enable option for relative links on shared pages #23

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mikemonteith
Copy link

@mikemonteith mikemonteith commented May 2, 2018

Add a middleware to make wagtail's pageurl templatetag create relative
links. Without this middleware, hyperlinks on sharing.mysite.com will
take a user to mysite.com.

Our reviewers want to review multiple draft pages at once, so the page links should keep a user on the sharing domain.

Additions

Added a middleware which will enable page links to keep the sharing domain

Testing

Middleware unit tests

Review

Preview this PR without the whitespace changes

Checklist

  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Code follows the standards laid out in the front end playbook
  • Passes all existing automated tests
  • New functions include new tests
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged
  • Visually tested in supported browsers and devices
  • Project documentation has been updated (including the "Unreleased" section of the CHANGELOG)

Add a middleware to make wagtail's pageurl templatetag create relative
links. Without this middleware, hyperlinks on sharing.mysite.com will
take a user to mysite.com.
@chosak
Copy link
Member

chosak commented May 2, 2018

@mikemonteith thank you for the PR! This is an interesting idea. Can you confirm how many Sites you're using?

As far as I can tell, Wagtail's SiteMiddleware will only ever set request.site to be None if there are either no Sites at all or if there are multiple Sites but the request doesn't match any of them. Does that latter case describe your setup? In the single Site case then request.site should already be set properly.

@willbarton willbarton changed the base branch from master to main August 20, 2020 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants