Foundation.mozilla.org: Redirects on About Us subpages

Created on 17 Apr 2018  路  16Comments  路  Source: mozilla/foundation.mozilla.org

Based on Jesse's endpoints doc, subnav menu items that we don't have copy for yet should redirect.

Redirects should be:

  • /about/impact (https://advocacy.mozilla.org/)
  • /about/strategy (https://mzl.la/foundation-strategy)
  • /about/careers (https://careers.mozilla.org/)

Note that order in nav should be:

  • /about
  • /about/impact
  • /about/leadership
  • /about/trademarks
  • /about/public-records
  • /about/strategy
  • /about/support
  • /about/careers

cc @alanmoo for triage

All 16 comments

@alanmoo is this possible now?

Not without some code still- Wagtail redirects do work, but if the page exists (a 200 http response), the redirect won't happen. So we need a way for the pages to be added to the menu, but for the redirect to still happen and I have a feeling that may need to happen with some hard coding embedded into our URLs.py file.

To be clear, here's what I tried:

  1. Create new child pages underAbout called impact, etc. and make sure "show page in navigation" box is checked.
  2. Add a wagtail redirect for those routes
  3. Observe that as long as the page exists (even in draft mode), the redirect doesn't work. But if the page doesn't exist, we can't get it to show up in the nav without hacking something in.

I don't quite get it but don't have permissions anyways so can you add these links and redirects?

What I'm saying is that approach doesn't work. I was documenting it so other people don't waste time trying the same thing trying to solve it.

Talked to @Pomax now that he's back, this is his first priority.

Summary of approach for posterity: We're probably going to need to do this kind of thing again in the future, so let's not hard code anything in. Secondly, let's not fight Wagtail. The most likely solution involves creating some type of pages for the desired links so they show up in the navigation, but adjusting something (be it a new "redirect" template or Wagtail's routing) so that those pages can redirect as needed. Pomax is going to ask the Wagtail folks what they'd suggest and formulate a plan.

asked https://github.com/wagtail/wagtail/issues/4544 to see if our idea will work, or whether there is already an established alternative.

As per the abovementioned issue, the notion of a redirecting page is fine, but rather than a meta refresh, the server itself can be made to force the redirect by overriding the def serve(self, request) function, and making it return a django HTTPResponeRedirect object.

Is there a way for us to host the content that is on https://drive.google.com/file/d/1Bl-h9d1IrhBXOskacm8eYkPteNMdxlN2/view right now as a real page? There is something kind of questionable in sending people to a google doc when they're on a mozilla website property, looking for core Mozilla information. At the very least, can we host this PDF file and just link directly to that instead of routing it through track-tastic google services?

I have a working RedirectingPage implementation, but the ordering of the nav menu is still an open question, given that the menu is simply derived from the page tree, meaning that the default order is simply based on which page was made first (older page, in terms of creationdate, is the first entry, most recent page is the last entry).

We could give each page a "menu order number", but that basically breaks the moment we add another page. Is the ordering for the navigation already fixed, or is it acceptable to for instance go with alphabetical ordering instead?

Linking to a PDF in drive is definitely not ideal. This is from the main site https://www.mozilla.org/en-US/foundation/ They link to the shortened URL https://mzl.la/foundation-strategy which then goes to drive. My only concern with hosting it somewhere else is if that strategy PDF gets updated, then we won't know.

Ordering is certainly something we will need in the future as we add sub-pages to Participate and Initiatives. But I'm ok with alphabetical on the About pages, for now.

It turns out there is a page ordering system already built into wagtail! So that solves that problem.

image

Note that some of these have a page type "Redirecting Page", which means they don't actually serve content but simply effect a 302 HTTP REDIRECT to whatever URL they're set to redirect to in the admin:

image

Yay Wagtail!

PR filed. We should probably document that orderability in the "how to wagtail" pages.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

taisdesouzalessa picture taisdesouzalessa  路  5Comments

alanmoo picture alanmoo  路  3Comments

kristinashu picture kristinashu  路  4Comments

benhohner picture benhohner  路  4Comments

hannahkane picture hannahkane  路  3Comments