Details shortcode
Insert an HTML details element into your content using the details shortcode.
New in
v0.140.0To override Hugo’s embedded details shortcode, copy the source code to a file with the same name in the layouts/_shortcodes directory.
Example
With this markup:
{{< details summary="See the details" >}}
This is a **bold** word.
{{< /details >}}Hugo renders this HTML:
<details>
<summary>See the details</summary>
<p>This is a <strong>bold</strong> word.</p>
</details>Which looks like this in your browser:
See the details
This is a bold word.
Arguments
- summary
- (
string) The content of the childsummaryelement rendered from Markdown to HTML. Default isDetails. - open
- (
bool) Whether to initially display the content of thedetailselement. Default isfalse. - class
- (
string) Theclassattribute of thedetailselement. - name
- (
string) Thenameattribute of thedetailselement. - title
- (
string) Thetitleattribute of thedetailselement.
Styling
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) { }Last updated:
August 23, 2025
:
content: Wrap calls to eturl shortcode in angle brackets (e09f6b0c5)
Improve this page