moodle / devdocs

Source of the Moodle Developer Resources and Documentation
https://moodledev.io/
Other
40 stars 283 forks source link

[repo] Adjust /docs to include next version #961

Closed andrewnicols closed 5 months ago

andrewnicols commented 5 months ago

This commit changes the unversioned docs at /docs/ to instead be at /docs/[nextVersionNumber].

It includes a redirect for /docs/* (where an existing page is not found) and it adds helpers to specify the version number in URLs and other locations.

Fixes #955

netlify[bot] commented 5 months ago

Deploy Preview for moodledevdocs ready!

Name Link
Latest commit 23b8a4c444379740aaf731ebcf2f648e8edae1ea
Latest deploy log https://app.netlify.com/sites/moodledevdocs/deploys/661798d4ed1efd000839d313
Deploy Preview https://deploy-preview-961--moodledevdocs.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

github-actions[bot] commented 5 months ago

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO PWA Report
/ 🟠 80 🟢 95 🟢 100 🟢 90 🟢 100 Report
/docs/4.4/apis/commonfiles 🟠 77 🟢 93 🟢 100 🟢 100 🟢 100 Report
/general/development/gettingstarted 🟠 78 🟢 95 🟢 100 🟢 90 🟢 100 Report
/general/releases 🟠 83 🟢 95 🟢 100 🟢 100 🟢 100 Report
andrewnicols commented 5 months ago

@stronk7 can you check if this behaves how you had in mind?

stronk7 commented 5 months ago

So, keeping apart already versioned docs (<= 4.3 right now) that will continue working EXACTLY the same, what we are doing here is:

  1. The current docs place in the repo continue being exactly the same (unversioned).
  2. We stop serving them in "unversioned" URL and always redirect for the to "versioned" URL (no matter it still doesn't exist as versioned doc). So https://moodledev.io/docs/xxx is redirected to https://moodledev.io/docs/4.4/xxx (no matter it's still served from unversioned docs.

And that's the unique change, the day that the 4.4-versioned copy is done, immediately then, https://moodledev.io/docs/xxx will be redirected to the next version https://moodledev.io/docs/4.5/xxx. And versioned will work for <= 4.4.

It sounds good for me. So, for links that we want to be auto-updated, we always use the unversioned URL and that will, automatically, redirect to the current one under development (/4.4/ right now, /4.5/ in a few weeks, ...). And whenever we want to point to a versioned one, we just add the version to the URL.

Ciao :-)