Skip to content

Commit d06f82c

Browse files
authored
Clarify that links to tutorials don't need a /tutorials/ prefix (#835)
* Clarify that links to tutorials don't need a /tutorials/ prefix * Explain that articles match first in tutorial file name collisions rdar://124124417
1 parent 8e6aaa3 commit d06f82c

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

Sources/docc/DocCDocumentation.docc/linking-to-symbols-and-other-content.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,10 @@ path in either source language.
166166
### Navigate to an Article
167167

168168
To add a link to an article, use the less-than symbol (`<`), the `doc` keyword,
169-
a colon (`:`), the name of the article, and a greater-than symbol
170-
(`>`). Don't include the article's file extension in the name.
169+
a colon (`:`), the article's file name without file extension, and a greater-than symbol
170+
(`>`).
171171

172-
```
172+
```markdown
173173
<doc:GettingStarted>
174174
```
175175

@@ -181,11 +181,17 @@ For example, the link to an article with a file name "Getting Started.md" is
181181
```
182182

183183
When DocC resolves the link, it uses the article's page title as the link's
184-
text, and the article's filename as the link's URL. Links to tutorials follow
185-
the same format, except you must add the `/tutorials/` prefix to the path:
184+
text. Links to tutorials follow the same format.
186185

186+
```markdown
187+
<doc:SlothCreator>
187188
```
188-
<doc:/tutorials/SlothCreator>
189+
190+
If you have an article file and a tutorial file with the same base name, DocC will resolve the `<doc:BaseName>` link to the article. To refer to the tutorial instead you can add a leading `tutorials` component to the path, with or without a leading slash:
191+
192+
```markdown
193+
<doc:tutorials/BaseName>
194+
<doc:/tutorials/BaseName>
189195
```
190196

191197
> Tip: You can also link to symbols using the `<doc:>` syntax. Just insert the
@@ -238,4 +244,4 @@ add the link's URL within the parentheses.
238244
[Apple](https://www.apple.com)
239245
```
240246

241-
<!-- Copyright (c) 2023 Apple Inc and the Swift Project authors. All Rights Reserved. -->
247+
<!-- Copyright (c) 2023-2024 Apple Inc and the Swift Project authors. All Rights Reserved. -->

0 commit comments

Comments
 (0)