diff --git a/exampleSite/README.md b/exampleSite/README.md index 9acc177df8..d3f0f78fcb 100644 --- a/exampleSite/README.md +++ b/exampleSite/README.md @@ -1,9 +1,9 @@ - récriture doc -> TODO - créer une section Showcase - créer des jolis thèmes de base (avec des noms) -> TODO -- ajouter les attachments -> TODO - ajouter les childs -> TODO +- ajouter les attachments -> OK - refaire la possibilité d'overrider le style/script/etc -> OK - sticky bar -> OK - ajouter Travis pour tester le thème quotidiennement avec les nouvelles versions de Hugo -> OK diff --git a/exampleSite/content/cont/pages/_index.md b/exampleSite/content/cont/pages/_index.md index 5080503ec7..9a5d225c5c 100644 --- a/exampleSite/content/cont/pages/_index.md +++ b/exampleSite/content/cont/pages/_index.md @@ -4,6 +4,26 @@ title: Pages weight: 5 --- + {{%/* children */%}} + +{{%children %}} + + {{%/* children description="true" */%}} + +{{%children description="true" %}} + + {{%/* children depth="3" showhidden="true" */%}} + +{{% children depth="3" showhidden="true" %}} + + {{%/* children style="h2" depth="3" description="true" */%}} + +{{% children style="h2" depth="3" description="true" %}} + + {{%/* children style="div" depth="999" */%}} + +{{% children style="div" depth="999" %}} + In **Hugo**, pages are the core of your site. Once it is configure, pages are definitely the added value to your documentation site. ## Folders diff --git a/layouts/shortcodes/children.html b/layouts/shortcodes/children.html new file mode 100644 index 0000000000..fe208398c5 --- /dev/null +++ b/layouts/shortcodes/children.html @@ -0,0 +1,96 @@ +{{ $showhidden := .Get "showhidden"}} +{{ $style := .Get "style" | default "li" }} +{{ $depth := .Get "depth" | default 1 }} +{{ $withDescription := .Get "description" | default false }} +{{ $sortTerm := .Get "sort" | default "Weight" }} + + + + +{{.Inner|safeHTML}} + +{{ define "childs" }} + {{ range .menu }} + {{ if and .Params.hidden (not $.showhidden) }} + {{else}} + + +{{if hasPrefix $.style "h"}} + {{$num := sub ( int (trim $.style "h") ) 1 }} + {{$numn := add $num $.count }} + +{{(printf "" $numn)|safeHTML}} +{{ .Title }} +{{(printf "" $numn)|safeHTML}} + +{{else}} +{{(printf "<%s>" $.style)|safeHTML}} +{{ .Title }} +{{(printf "" $.style)|safeHTML}} +{{end}} + + + + + + {{if $.description}} + {{if .Description}} +

{{.Description}}

+ {{else}} +

{{.Summary}}

+ {{end}} + {{end}} + + + + {{ if lt $.count $.depth}} +{{if eq $.style "li"}} + +{{end}} + {{end}} + + {{end}} + {{end}} +{{end}} \ No newline at end of file diff --git a/static/css/theme.css b/static/css/theme.css index 04aa5cb81f..4b82d8cd74 100644 --- a/static/css/theme.css +++ b/static/css/theme.css @@ -530,6 +530,8 @@ div.notices.tip p:first-child:after { content: 'Tip'; } +/* attachments shortcode */ + section.attachments { margin: 2rem 0; position: relative; @@ -588,6 +590,33 @@ section.attachments.note .attachments-files { background: #E7F2FA; } +/* Children shortcode */ + +/* Children shortcode */ +.children p { + font-size: small; + margin-top: 0px; + padding-top: 0px; + margin-bottom: 0px; + padding-bottom: 0px; +} +.children-li p { + font-size: small; + font-style: italic; + +} +.children-h2 p, .children-h3 p { + font-size: small; + margin-top: 0px; + padding-top: 0px; + margin-bottom: 0px; + padding-bottom: 0px; +} +.children h3,.children h2 { + margin-bottom: 0px; + margin-top: 5px; +} + code, kbd, pre, samp { font-family: "Consolas", menlo, monospace; font-size: 92%;