Skip to content

Commit 667cade

Browse files
committed
content: Document mastodon and peertube shortcodes
1 parent b3386a1 commit 667cade

File tree

3 files changed

+104
-0
lines changed

3 files changed

+104
-0
lines changed

content/en/shortcodes/mastodon.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
title: Mastodon shortcode
3+
linkTitle: Mastodon
4+
description: Embed a Mastodon post in your content using the mastodon shortcode.
5+
categories: []
6+
keywords: []
7+
---
8+
9+
> [!note]
10+
> To override Hugo's embedded `mastodon` shortcode, copy the [source code][] to a file with the same name in the `layouts/_shortcodes` directory.
11+
12+
To display a Mastodon post with this URL:
13+
14+
```text
15+
https://socel.net/@BGP/113805114250504687
16+
```
17+
18+
Include this in your Markdown:
19+
20+
```text
21+
{{</* mastodon url="https://socel.net/@BGP/113805114250504687" */>}}
22+
```
23+
24+
Hugo renders this to:
25+
26+
{{< mastodon url="https://socel.net/@BGP/113805114250504687" >}}
27+
28+
[source code]: <{{% eturl mastodon %}}>

content/en/shortcodes/peertube.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
title: Peertube shortcode
3+
linkTitle: Peertube
4+
description: Embed a PeerTube video in your content using the peertube shortcode.
5+
categories: []
6+
keywords: []
7+
---
8+
9+
> [!note]
10+
> To override Hugo's embedded `peertube` shortcode, copy the [source code][] to a file with the same name in the `layouts/_shortcodes` directory.
11+
12+
## Example
13+
14+
To display a PeerTube video with this URL:
15+
16+
```text
17+
https://toobnix.org/w/5jBegFpNbffA1nhmp32kqR
18+
```
19+
20+
Include this in your Markdown:
21+
22+
```text
23+
{{</* peertube url="https://toobnix.org/w/5jBegFpNbffA1nhmp32kqR" */>}}
24+
```
25+
26+
Hugo renders this to:
27+
28+
{{< peertube url="https://toobnix.org/w/5jBegFpNbffA1nhmp32kqR" >}}
29+
30+
## Parameters
31+
32+
url
33+
: (`string`) The URL of the PeerTube video.
34+
35+
start
36+
: (`string`) The time, from the start of the video, when the player should start playing the video (e.g., `42s`, `6m7s`).
37+
38+
stop
39+
: (`string`) The time, from the start of the video, when the player should stop playing the video (e.g., `42s`, `6m7s`).
40+
41+
loading
42+
: (`string`) The loading attribute of the `iframe` element, either `eager` or `lazy`. Default is `eager`.
43+
44+
width
45+
: (`int`) The width of the video in pixels. Responsive if `0`. Default is `0`.
46+
47+
allowFullScreen
48+
: (`bool`) Whether to allow full screen playback. Default is `true`.
49+
50+
autoplay
51+
: (`bool`) Whether to automatically play the video. Forces `mute` to `true`. Default is `false`.
52+
53+
controls
54+
: (`bool`) Whether to display the video controls. Default is `true`.
55+
56+
displayLink
57+
: (`bool`) Whether to display the video link. Default is `true`.
58+
59+
displayTitle
60+
: (`bool`) Whether to display the video title. Default is `true`.
61+
62+
displayWarning
63+
: (`bool`) Whether to display the privacy warning. Default is `true`.
64+
65+
loop
66+
: (`bool`) Whether to indefinitely repeat the video. Default is `false`.
67+
68+
mute
69+
: (`bool`) Whether to mute the video. Always `true` when `autoplay` is `true`. Default is `false`.
70+
71+
p2p
72+
: (`bool`) Whether to enable peer-to-peer bandwidth sharing. Default is `true`.
73+
74+
[source code]: <{{% eturl param %}}>

data/embedded_template_urls.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
'gist' = '_shortcodes/gist.html'
2525
'highlight' = '_shortcodes/highlight.html'
2626
'instagram' = '_shortcodes/instagram.html'
27+
'mastodon' = '_shortcodes/mastodon.html'
2728
'param' = '_shortcodes/param.html'
29+
'peertube' = '_shortcodes/peertube.html'
2830
'qr' = '_shortcodes/qr.html'
2931
'ref' = '_shortcodes/ref.html'
3032
'relref' = '_shortcodes/relref.html'

0 commit comments

Comments
 (0)