Details shortcode
Insert an HTML details element into your content using the details shortcode.
Usage
The details shortcode renders an HTML details element, converting the content between its opening and closing tags from Markdown to HTML.
Use CSS to style the details element, the summary element, and the content itself:
/* target the details element */
details { }
/* target the summary element */
details > summary { }
/* target the children of the summary element */
details > summary > * { }
/* target the content */
details > :not(summary) { }To override Hugo’s embedded details shortcode, copy the source code to a file with the same name in the layouts/_shortcodes directory.
Arguments
The details shortcode accepts named arguments.
class- (
string) Theclassattribute of thedetailselement. name- (
string) Thenameattribute of thedetailselement. open- (
bool) Whether to initially display the content of thedetailselement. Default isfalse. summary- (
string) The content of the childsummaryelement, rendered from Markdown to HTML. Default isDetails. title- (
string) Thetitleattribute of thedetailselement.
Examples
content/example.md
{{< details summary="See the details" >}}
This is a **bold** word.
{{< /details >}}Hugo renders this to:
<details>
<summary>See the details</summary>
<p>This is a <strong>bold</strong> word.</p>
</details>With the content initially displayed:
content/example.md
{{< details summary="See the details" open=true >}}
This is a **bold** word.
{{< /details >}}Hugo renders this to:
<details open>
<summary>See the details</summary>
<p>This is a <strong>bold</strong> word.</p>
</details>Last updated:
November 16, 2026
:
content: Apply style guide to shortcodes section (bd893690d)
Improve this page