mirror of https://github.com/gohugoio/hugo
1.6 KiB
Executable File
1.6 KiB
Executable File
title | description | categories | keywords | menu | weight | toc | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Details | Insert an HTML details element into your content using the details shortcode. |
|
|
true |
{{< new-in 0.140.0 />}}
{{% note %}}
To override Hugo's embedded details
shortcode, copy the [source code] to a file with the same name in the layouts/shortcodes
directory.
[source code]: {{% eturl details %}} {{% /note %}}
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:
{{< details summary="See the details" >}} This is a bold word. {{< /details >}}
Parameters
- summary
- (
string
) The content of the childsummary
element rendered from Markdown to HTML. Default isDetails
. - open
- (
bool
) Whether to initially display the content of thedetails
element. Default isfalse
. - class
- (
string
) Theclass
attribute of thedetails
element. - name
- (
string
) Thename
attribute of thedetails
element. - title
- (
string
) Thetitle
attribute of thedetails
element.
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) { }