Skip to content

Commit 56480f4

Browse files
authored
Merge pull request #1275 from nbogie/nb-doc-canonical-url-structure
document trailing slashes (and case) in new docs/url_conventions.md
2 parents 93edbbd + f6c0b8d commit 56480f4

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

docs/url_conventions.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# URL conventions
2+
3+
## Trailing slash in URLs
4+
5+
All URLs for resources on the website should end with a slash character (`/`).
6+
7+
For example, the correct URL for the reference page about the `circle` function is
8+
* good: https://beta.p5js.org/reference/p5/circle/
9+
* bad: https://beta.p5js.org/reference/p5/circle
10+
11+
More correctly, it should come at the end of the _path_ part of the URL.
12+
13+
If a query string or hash/fragment is present in the URL, the trailing slash should come before those, as shown in these examples:
14+
15+
Example with a query string
16+
* good: https://beta.p5js.org/search/?term=colorMode
17+
* bad: https://beta.p5js.org/search?term=colorMode/
18+
* bad: https://beta.p5js.org/search?term=colorMode
19+
20+
Example with a hash / fragment part
21+
* good: https://beta.p5js.org/contribute/documentation_style_guide/#comments
22+
* bad: https://beta.p5js.org/contribute/documentation_style_guide#comments/
23+
24+
#### Other correct examples
25+
* https://beta.p5js.org/download/
26+
* https://beta.p5js.org/reference/
27+
* https://beta.p5js.org/tutorials/
28+
* https://beta.p5js.org/examples/
29+
* https://beta.p5js.org/tutorials/get-started/
30+
* https://beta.p5js.org/examples/shapes-and-color-shape-primitives/
31+
* https://beta.p5js.org/
32+
33+
### Automatic trailing slash addition
34+
While the production webserver _may_ add a trailing slash to a requested URL when it is missing, but this should not be relied upon.
35+
Instead write (or generate) links that follow the rules above.
36+
37+
## Case in URLs
38+
39+
URL casing is somewhat inconsistent across the website. Guidelines for new resources:
40+
41+
* Prefer lower-case
42+
* Spaces should not be used in URLs.
43+
* In place of spaces, dashes (`-`) should ideally be used in preference to underscores (`_`).
44+
* First, however, follow established local conventions used by other resources of the same type
45+
* e.g. all contributor docs use underscores "like_this"
46+
47+
#### Examples of kebab-case URL:
48+
* https://beta.p5js.org/tutorials/variables-and-change/
49+
* https://beta.p5js.org/examples/3d-orbit-control/
50+
* https://beta.p5js.org/code-of-conduct/
51+
52+
### A case exception: reference pages
53+
54+
In reference pages, the URLs follow the names of the functions, classes, and variables. So, they include some capitals and use "camel-case" e.g. `createCanvas`.
55+
56+
#### Examples of reference page URLs
57+
* https://p5js.org/reference/p5.Vector/fromAngle/
58+
* https://beta.p5js.org/reference/p5/p5.Image/
59+
60+
More on reference page URLs can be found in https://beta.p5js.org/contribute/contributing_to_the_p5js_reference/#linking

0 commit comments

Comments
 (0)