Skip to content

Commit 3831e28

Browse files
mcanouilcderv
andauthored
docs: add target and rel options to website listings (#2338)
* docs: add target and rel options to website listings * docs: align listing link options with merged behavior --------- Co-authored-by: Christophe Dervieux <christophe.dervieux@gmail.com>
1 parent 9beab43 commit 3831e28

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

‎docs/websites/website-listings.qmd‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,39 @@ It is possible to customize the appearance of listings using the following optio
233233

234234
In addition to the above listing-wide options, each listing type has a variety of options to customize its appearance.
235235

236+
### Link Targets
237+
238+
{{< prerelease-callout 1.12 >}}
239+
240+
Use the `target` and `rel` options to set the `target` and `rel` attributes of the item links.
241+
These options have the same meaning as the `target` and `rel` options of navigation items.
242+
They apply to default, grid, and table listings.
243+
You can set them on the listing, on an item in the listing `contents`, or in a listed document's front matter.
244+
Values in `contents` override the document's front-matter values.
245+
For each option, a nonempty item value overrides the listing value.
246+
For example, this listing opens all items in a new tab, except the local post:
247+
248+
``` yaml
249+
listing:
250+
target: _blank
251+
contents:
252+
- path: https://example.com/article
253+
title: "External article"
254+
- path: posts/local-post.qmd
255+
title: "Local post"
256+
target: _self
257+
```
258+
259+
If `target` opens a new tab and `rel` is not set, `rel` is `noopener`.
260+
An explicit listing or item `target` takes precedence over `link-external-newwindow`.
261+
For example, `target: _self` keeps an external item in the current tab even when `link-external-newwindow: true`.
262+
263+
Listing item links with `target: _blank` receive the accessible description "(opens in a new tab)".
264+
This applies to internal and external listing links, independently of `link-external-newwindow`.
265+
266+
With `table-hover: true`, clicking a table row also honors its item link's `target` and `rel`.
267+
RSS feeds and custom listing templates do not apply these options automatically.
268+
236269
## Categories
237270

238271
In addition to displaying the listing contents, listings can also automatically add a list of categories to the page that they appear on. To enable categories you can set the `categories` option like:

0 commit comments

Comments
 (0)