docs icon indicating copy to clipboard operation
docs copied to clipboard

Improve links between examples and docs

Open embedded-creations opened this issue 8 years ago • 0 comments

I'm going through docs from the perspective of a beginner Photon user (I'm writing some tutorials) and have so far found two broken links in example code and submitted pull requests. There's got to be a less fragile way of putting links to documentation in the examples.

Here's an idea: don't use full URLs in the examples, but short URLs that redirect to the actual docs URL (e.g. what you already do with http://particle.io/buttonstart). Keep a list of the all the redirects. If you're doing a major change that would change a URL for a piece of documentation, you can search the list and update the redirects all at once without touching the example code.

Example from the PR I just submitted for an Internet Button example:

  • The example pointed to http://docs.particle.io/photon/firmware/#spark-function which does redirect to https://docs.particle.io/reference/firmware/photon/ but is missing #particle-function- so as a beginner user I'm left wondering what I'm supposed to be looking at.
  • This could be a short URL e.g. http://docs.particle.io/button-function which would have redirected to the original URL
  • After doing the major revision of the docs, you'd know that anything starting with http://docs.particle.io/photon/firmware had moved, and "spark" was renamed to "particle", so you could search through the list of URL redirects and update all the links at once without needing to search through all the examples and update individually (which probably wouldn't happen anyway)
  • The URL redirect would now point to https://docs.particle.io/reference/firmware/photon/#particle-function-
  • Your users are happy
  • Profit

embedded-creations avatar Nov 25 '15 13:11 embedded-creations