Skip to content

Commit e7be954

Browse files
(DOCSP-22851): Update linking guidelines (#109)
* (DOCSP-22851): Add linking guidelines * retry autobuilder * formatting * wording * formatting * cleanup
1 parent 191d21c commit e7be954

File tree

1 file changed

+155
-117
lines changed

1 file changed

+155
-117
lines changed

source/style-guide/style/links-and-cross-references.txt

Lines changed: 155 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -4,135 +4,173 @@
44
Links and Cross-References
55
==========================
66

7+
.. contents:: On this page
8+
:local:
9+
:backlinks: none
10+
:depth: 2
11+
:class: singlecol
12+
713
.. default-domain:: mongodb
814

915
.. include:: /includes/styles/corrections.rst
1016

11-
Use cross-references to:
12-
13-
- Help users navigate content
14-
- Find content related to what they're currently viewing.
15-
16-
You can add hyperlinks to cross-references.
17-
18-
.. note::
17+
Documentation writers use links to direct users to related material
18+
outside of the current page or section. Links may be:
1919

20-
{+Rst+} refers to text that points to other sections in the current document or in another document, or to other documents as
21-
:sphinx-rst:`cross-references </roles.html#cross-referencing-syntax>`. Cross-references can include hyperlinks. You would use an {+rst+} role to format add a hyperlink to a cross-reference.
22-
{+Rst+} refers to hyperlinks to other specific URLs as
23-
:sphinx-rst:`links </basics.html#hyperlinks>`. This document uses cross-reference and link somewhat interchangeably.
20+
- Inline textual references to different sections. For example:
2421

25-
- When you refer to content within the same article or section, such
26-
as tables, figures, examples, or a subsection, create a simple
27-
textual cross-reference. If the referenced copy falls much further
28-
down the page, link to that content.
22+
"Partial indexes include more details about indexed documents compared
23+
to :manual:`Sparse Indexes </core/index-sparse/>`."
2924

30-
- When you refer to other content, whether created by MongoDB or
31-
outside of MongoDB, provide a link to that content. Verify that the
32-
link works and that the content is current. Periodically check the
33-
link and content. If you link to Uncyclopedia or any other site that
34-
uses history, link to a specific revision of that page or content.
25+
- Explicit references to different sections. For example:
3526

36-
.. example::
27+
"To learn more about aggregation pipelines, see:
3728

38-
.. code-block:: rst
29+
- :ref:`aggregation-expression-operators`
30+
- :ref:`aggregation-pipeline-operator-reference`
31+
- `Practical MongoDB Aggregations
32+
<https://www.practical-mongodb-aggregations.com>`__"
3933

40-
Timestamp in the number of seconds that have elapsed since the
41-
:wikipedia:`UNIX epoch </Unix_time?oldid=828172017>` when
42-
someone last updated this setting.
34+
- Explicit hyperlinks to specific URLs. For example, a link to a GitHub
35+
repository.
4336

44-
.. _sg-link-text:
45-
46-
Link and Cross-Reference Text
47-
-----------------------------
37+
Best Practices
38+
--------------
4839

4940
Use the following guidelines to create clear and specific
50-
cross-references. For examples, see the table at the end of
51-
the topic.
52-
53-
- Begin a cross-reference sentence with the purpose or benefit of the
54-
cross-reference (such as more information or examples). Such context
55-
helps users decide whether to follow the reference.
56-
57-
- Use *To learn more about* rather than *For more information on*.
58-
59-
- Use *preceding* and *following* to locate information in an article
60-
or topic. Don't use *above*, *below*, *earlier*, or *later*.
61-
62-
- Ensure that the cross-refernce or link text sufficiently describes
63-
the target content.
64-
65-
- For links at the end of an article or topic that point to related
66-
information or to a next step, use the title of or a heading in the
67-
target content as the link text.
68-
69-
- When links are inline, use about three or four words of existing
70-
text as the link text. Choose words that best describe the
71-
target content.
72-
73-
- If existing text can't sufficiently describe the target
74-
content, create a cross-reference sentence for the link. For the
75-
link text, use the title of or a heading in the target
76-
content, if possible. Avoid providing an actual URL, unless you
77-
think that having the URL is helpful for the user.
78-
79-
- Don't provide links from ambiguous phrases such as *Click here* or
80-
*More information*.
81-
82-
.. note::
83-
84-
- Provide links *inline* only when it's necessary or helpful for
85-
the user to follow the link to understand the current topic or
86-
complete the task.
87-
88-
- Provide links to related but not essential information, and to
89-
next steps, at the end of the article or section, preferrably
90-
under a ``.. seealso::`` directive.
91-
92-
- If a link points to a location other than the current site (for
93-
example, out of the Support website or away from
94-
www.mongodb.com/docs), provide context that describes the location.
95-
96-
.. _sg-link-formatting:
97-
98-
Link and Cross-Reference Formatting
99-
-----------------------------------
100-
101-
- Don't code a link to open in a new tab or window. Users can choose
102-
whether they want open a link in a new tab or window.
103-
104-
- If your article or topic has multiple subheadings, provide a TOC
105-
(jump list) at the beginning of the article or topic, after an
106-
introduction. Use the heading text as the link text, and typically
107-
link only to the top-level headings in the article or topic.
108-
109-
.. note::
110-
111-
Don't create a TOC within the article manually. Add the
112-
``.. contents::`` directive to generate a TOC.
113-
114-
- Don't use quotation marks around link text.
115-
116-
- Create and format links using either:
117-
118-
- custom roles (like ``:rfc:``, ``:manual:`` or ``:gh:``), or
119-
- standard {+rst+}
120-
:sphinx-rst:`external links </basics.html#external-links>` ending
121-
with two underscores instead of one.
122-
123-
.. note::
124-
125-
The documentation rendering engine expects links to be unique if
126-
they end with only one underscore. If you create two links to
127-
the same URL with only one underscore, the engine returns a
128-
build error. If you end the link with two underscores, the
129-
engine creates modifies subsequent URLs to prevent this build
130-
error.
131-
132-
- Test links to ensure that they're live and that they point to
133-
the correct target.
134-
135-
- Don't link to information more than once in an article or topic.
41+
links and cross-references.
42+
43+
Link with Care
44+
~~~~~~~~~~~~~~
45+
46+
Before you link to a separate page or section, consider whether that
47+
link actually aids user understanding. To minimize reader disruption,
48+
aim to keep users on the page they're currently reading as much as
49+
possible. If you are considering adding a link, see if the content would
50+
be better served by providing a brief definition or key concept on the
51+
page the reader is currently reading, rather than making the user do
52+
additional navigation on their own.
53+
54+
Be aware that providing a brief definition or attempting to explain a
55+
concept on the current page may introduce maintenance issues. If the
56+
behavior of the topic we're describing changes, it may become more
57+
difficult to track down each place that topic is mentioned and know what
58+
needs to be updated. When possible, use an include to single-source
59+
content and reduce future maintenance.
60+
61+
Consider Link Placement
62+
~~~~~~~~~~~~~~~~~~~~~~~
63+
64+
Generally, an explicit reference at the end of a page or section is less
65+
disruptive than an inline textual reference, especially when there are
66+
several inline references in succession. If you introduce a few concepts
67+
you'd like to provide links to, consider grouping links to concepts into
68+
either:
69+
70+
- A "Learn More" section with a consolidated list of links.
71+
- A ``..seealso`` directive at the end of the section.
72+
73+
By using one of these approaches, users who just want to complete a task
74+
aren't distracted by additional links, and users who want to learn more
75+
about MongoDB concepts can click through and explore the linked content.
76+
77+
Avoid Inline References in Tutorials
78+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
79+
80+
Avoid inline textual references in tutorials or stepped procedures. If
81+
users follow inline references while in the middle of a procedure, they
82+
may have difficulty navigating back and reorienting themselves with
83+
their current step.
84+
85+
Additionally, avoid stacking multiple admonitions directly after one
86+
another, as these can be distracting for users. To avoid stacking
87+
admonitions, consider grouping supplemental information from admonitions
88+
into a dedicated section.
89+
90+
Inline textual references may be appropriate for more reference-heavy
91+
pages. Admonitions can potentially reduce scannability of tables and
92+
options lists, and should therefore be avoided in those contexts
93+
whenever possible.
94+
95+
Minimize Repeated Links
96+
~~~~~~~~~~~~~~~~~~~~~~~
97+
98+
Don't link to the same target multiple times in the same section.
99+
100+
You may link to the same target multiple times on the same page, but
101+
think carefully about whether it's absolutely necessary. For example, if
102+
a page is particularly long and contains many sections, then it might be
103+
helpful to link to a target an additional time or two. Users may
104+
immediately navigate to a section far down on a page and miss the
105+
initial reference.
106+
107+
When providing repeated links, ensure that the same style is used each
108+
time a link is used. Consider whether a plaintext link or a
109+
monospace link is appropriate. Plaintext links may be less visually
110+
distracting than monospace links because they do not have the
111+
surrounding block.
112+
113+
Make Link Text Clear
114+
~~~~~~~~~~~~~~~~~~~~
115+
116+
Strive to be clear about where exactly a link will take a reader. Follow
117+
these guidelines for link text to ensure readers know the purpose of a
118+
link and where it will take them:
119+
120+
- Use descriptive text indicating where the URL will take the reader.
121+
- Avoid jargon in link text. Using technical terms as needed, such as
122+
the name of an operator or method, is appropriate.
123+
- Use normal English words as opposed to URLs.
124+
- If a link will take a user away from the MongoDB documentation, such
125+
as to GitHub or Uncyclopedia, make the target site clear in the link
126+
text.
127+
- Avoid "Click here." It's bad for search engine optimization and
128+
doesn't adequately describe the target.
129+
130+
Link text should begin with the purpose of the cross-reference. For
131+
example:
132+
133+
- "To learn more, see..."
134+
- "To see examples..."
135+
- "For more information, see..."
136+
137+
The linked text should correspond to the title of the page or section
138+
you are linking to. For example, consider the following sentence which
139+
provides a cross-reference:
140+
141+
To learn more, see the guide on Finding Multiple Documents in the
142+
Node.js Driver Documentation.
143+
144+
The linked text should correspond to the title of the guide. In this
145+
example, the title of the guide is "Finding Multiple Documents". The
146+
complete link sentence should look like this:
147+
148+
To learn more, see the guide on :driver:`Finding Multiple Documents
149+
</node/current/usage-examples/find/>` in the Node.js Driver
150+
Documentation.
151+
152+
Use MongoDB-Domain Links When Possible
153+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
154+
155+
Link to the MongoDB domain whenever possible instead of directing users
156+
to external domains. Some topics described in our documentation are also
157+
covered by other products' documentation, external tutorials, or
158+
Uncyclopedia. By keeping users in the MongoDB domain, we ensure that we are
159+
in full control of the content presented, and maintain trust with users.
160+
161+
Directing users outside of the MongoDB domain is acceptable when it is
162+
critical to provide additional context on a topic and we do not have
163+
sufficient context in our documentation to cover user needs.
164+
165+
Use ``:ref:`` Links Instead of ``:doc:`` Links
166+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
167+
168+
When linking to content within the MongoDB documentation, use ``:ref:``
169+
links instead of ``:doc:`` links. ``:ref:`` links make maintenance
170+
easier in the event that a section is refactored or consolidated into a
171+
new page because we can simply bring the reference along with the
172+
paragraph or section we're pointing to. When using ``:doc:`` links, a
173+
refactor can potentially break links if the page is renamed or removed.
136174

137175
.. _sg-link-examples:
138176

@@ -165,7 +203,7 @@ Link and Cross-Reference Examples
165203
:mdbdrivers:`MongoDB Drivers site </>`.
166204
- The most current versions of all drivers are located on the
167205
MongoDB Developer Docs site:
168-
https://www.mongodb.com/docs/drivers/.
206+
https://docs.mongodb.com/ecosystem/drivers/.
169207

170208
* - You can obtain the API key by logging in to
171209
:mdbcloud:`Atlas </>` and clicking the

0 commit comments

Comments
 (0)