mirror of
https://github.com/alex-shpak/hugo-book.git
synced 2024-11-21 19:09:29 +00:00
Add section shortcode, to render children
This commit is contained in:
parent
aa7c486e76
commit
b8b7184e89
@ -137,7 +137,8 @@
|
||||
}
|
||||
|
||||
dd {
|
||||
margin-inline-start: $padding-16 * 2;
|
||||
margin-inline-start: $padding-16;
|
||||
margin-bottom: $padding-16;
|
||||
}
|
||||
}
|
||||
|
||||
|
15
exampleSite/content/docs/shortcodes/section/_index.md
Normal file
15
exampleSite/content/docs/shortcodes/section/_index.md
Normal file
@ -0,0 +1,15 @@
|
||||
---
|
||||
bookCollapseSection: true
|
||||
---
|
||||
|
||||
# Section
|
||||
|
||||
Section renders pages in section as definition list, using title and description.
|
||||
|
||||
## Example
|
||||
|
||||
```tpl
|
||||
{{</* section */>}}
|
||||
```
|
||||
|
||||
{{<section>}}
|
1
exampleSite/content/docs/shortcodes/section/page1.md
Normal file
1
exampleSite/content/docs/shortcodes/section/page1.md
Normal file
@ -0,0 +1 @@
|
||||
# Page 1
|
1
exampleSite/content/docs/shortcodes/section/page2.md
Normal file
1
exampleSite/content/docs/shortcodes/section/page2.md
Normal file
@ -0,0 +1 @@
|
||||
# Page 2
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
{"Target":"book.min.947656565f9248015f7b2c792cb8b8c13ad749e25295c0634f4c7f1d1bde6a0a.css","MediaType":"text/css","Data":{"Integrity":"sha256-lHZWVl+SSAFfeyx5LLi4wTrXSeJSlcBjT0x/HRveago="}}
|
||||
{"Target":"book.min.1205ebacf147e31d6bd6f74be1ef8d96f4bb2c4943c68e5a39b4e988a774a2b0.css","MediaType":"text/css","Data":{"Integrity":"sha256-EgXrrPFH4x1r1vdL4e+NlvS7LElDxo5aObTpiKd0orA="}}
|
10
layouts/shortcodes/section.html
Normal file
10
layouts/shortcodes/section.html
Normal file
@ -0,0 +1,10 @@
|
||||
<dl>
|
||||
{{ range .Page.Pages }}
|
||||
<dt>
|
||||
<a href="{{ .RelPermalink }}">{{ partial "docs/title" . }}</a>
|
||||
</dt>
|
||||
<dd>
|
||||
{{ default .Summary .Description }}
|
||||
</dd>
|
||||
{{ end }}
|
||||
</dl>
|
Loading…
Reference in New Issue
Block a user