Skip to content

Commit ebbd2e8

Browse files
authored
Clarify the shortcode Ordinal method
1 parent b7716ed commit ebbd2e8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

‎content/en/methods/shortcode/Ordinal.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ action:
1111

1212
The `Ordinal` method returns the zero-based ordinal of the shortcode in relation to its parent. If the parent is the page itself, the ordinal represents the position of this shortcode in the page content.
1313

14+
{{% note %}}
15+
Hugo increments the ordinal with each shortcode call, regardless of the specific shortcode type. This means that the ordinal value is tracked sequentially across all shortcodes within a given page.
16+
{{% /note %}}
17+
1418
This method is useful for, among other things, assigning unique element IDs when a shortcode is called two or more times from the same page. For example:
1519

1620
{{< code file=content/about.md lang=md >}}

0 commit comments

Comments
 (0)