Skip to content

Commit a7a70b4

Browse files
committed
add draft of url_conventions.md in docs/, around trailing slash (and case)
1 parent 93edbbd commit a7a70b4

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

docs/url_conventions.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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. It should come _before_ any query string (starts with a question mark `?`), and before any hash / fragment part (starts with a hash character `#`), if either of those is present.
12+
13+
Example before a query string
14+
* good: https://beta.p5js.org/search/?term=colorMode
15+
* bad: https://beta.p5js.org/search?term=colorMode
16+
* bad: https://beta.p5js.org/search?term=colorMode/
17+
18+
Example before a hash / fragment part
19+
* good: https://beta.p5js.org/contribute/documentation_style_guide/#comments
20+
* bad: https://beta.p5js.org/contribute/documentation_style_guide#comments/
21+
22+
#### Other correct examples
23+
* https://beta.p5js.org/download/
24+
* https://beta.p5js.org/reference/
25+
* https://beta.p5js.org/tutorials/
26+
* https://beta.p5js.org/examples/
27+
* https://beta.p5js.org/tutorials/get-started/
28+
* https://beta.p5js.org/examples/shapes-and-color-shape-primitives/
29+
* https://beta.p5js.org/
30+
31+
The production webserver _may_ add a trailing slash to a requested URL when it is missing, but this should not be relied upon.
32+
33+
34+
## Case in URLs
35+
36+
URL casing is somewhat inconsistent across the website. Guidelines for new resources:
37+
38+
* Prefer lower-case
39+
* Spaces should not be used in URLs.
40+
* In place of spaces, dashes (`-`) should ideally be used in preference to underscores (`_`).
41+
* Follow the local conventions used by other resources of the same type
42+
* e.g. contributor docs use underscores "like_this"
43+
* e.g. most other resources (tutorials, examples, code-of-conduct) use kebab-case "like-this"
44+
45+
#### Examples of kebab-case URL:
46+
* https://beta.p5js.org/tutorials/variables-and-change/
47+
* https://beta.p5js.org/examples/3d-orbit-control/
48+
* https://beta.p5js.org/code-of-conduct/
49+
50+
### A case exception: reference pages
51+
52+
In reference pages, the URLs follow the names of the functions, classes, and variables. So they include some capitals and use camel-case (`createCanvas`, not `create-canvas`).
53+
54+
#### Examples of reference page URLs
55+
* https://p5js.org/reference/p5.Vector/fromAngle/
56+
* https://beta.p5js.org/reference/p5/p5.Image/
57+
58+
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)