Skip to content

Instantly share code, notes, and snippets.

@kapolos
Created October 22, 2018 15:46
Show Gist options
  • Save kapolos/71c12a3715052e02f455ce00e2e60514 to your computer and use it in GitHub Desktop.
Save kapolos/71c12a3715052e02f455ce00e2e60514 to your computer and use it in GitHub Desktop.
Notes on the logic of url resolution.

Overview

Given //site/variable, what are the steps to resolve the template & content. The priority is from higher to lower. Once a match is found, the chain breaks.

Logic

  1. Check if variable is a hardcoded url (like the footer links, about page, login page etc.)
  2. Decompose variable into its parts (e.g. ["inner-circle", "special-reports"])
  3. Check if the first part belongs to a subscription (e.g. inner-circle).If it's part of a subscription, use the rules for it (next segment).
  4. If it's not part of a subscription, we assume it is free content. Use the template for content and ask the lambda function for the proper _id.
  5. No match found, show a 404 page.

Subscription section

  1. /sub-code/ -> the subscription's dashboard
  2. /sub-code/special-reports -> the list of special reports (where the "view all reports" link leads)
  3. /sub-code/archives -> issues & updates (where the "view all issues & updates" link leads)
  4. /sub-code/portfolio -> the portfolio page for the subscription
  5. /sub-code/training -> the training page (not implemented yet)
  6. Reports can belong to multiple products, so they will not have /sub-code in-front. It will have a /report prefix.
  7. /sub-code/??? -> it would match a single issue/report.

Qs

  1. What should the url for "my subscriptions" be? (it belongs to rule 1 in the Logic section)
  2. What is the proper url for a special report? /reports/???. It would need to include a unique identifier. Possible example: /reports/the actual title.${_id}
  3. Same Q for the issues/updates.
  4. Could we add in our Mongo set a free article from prod with its real url to help implement the matching for the free articles? Or it is just a matter of using article.cloudlgr.com instead of dev-article.cloudlgr.com?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment