mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-01-18 10:50:24 +00:00
docs: showcase page layout using type
frontmatter #891
This commit is contained in:
parent
6b5183481a
commit
f490174e4b
4 changed files with 28 additions and 4 deletions
7
exampleSite/archetypes/chapter-overview.md
Normal file
7
exampleSite/archetypes/chapter-overview.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
+++
|
||||
title = "{{ replace .Name "-" " " | title }}"
|
||||
type = "chapter-overview"
|
||||
weight = 1
|
||||
+++
|
||||
|
||||
This is a new chapter.
|
|
@ -1,7 +1,7 @@
|
|||
+++
|
||||
ordersectionsby = "title"
|
||||
title = "Shortcodes"
|
||||
type = "chapter"
|
||||
type = "chapter-overview"
|
||||
weight = 3
|
||||
+++
|
||||
|
||||
|
@ -12,5 +12,3 @@ But this happens to be a bad idea. Everyone uses Markdown because it's pure and
|
|||
To avoid this limitations, Hugo created [shortcodes](https://gohugo.io/extras/shortcodes/). A shortcode is a simple snippet inside a page.
|
||||
|
||||
The Relearn theme provides multiple shortcodes on top of existing ones.
|
||||
|
||||
{{%children containerstyle="div" style="h2" description="true" %}}
|
||||
|
|
19
exampleSite/layouts/chapter-overview/views/article.html
Normal file
19
exampleSite/layouts/chapter-overview/views/article.html
Normal file
|
@ -0,0 +1,19 @@
|
|||
|
||||
<article class="chapter narrow">
|
||||
<header class="headline">
|
||||
{{- partial "content-header.html" . }}
|
||||
</header>
|
||||
{{ partial "heading-pre.html" . }}<div class="article-subheading">{{ T "Chapter" .Params.Weight }}</div>
|
||||
{{ partial "heading.html" . }}{{ partial "heading-post.html" . }}
|
||||
|
||||
{{ partial "article-content.html" . }}
|
||||
{{ partial "shortcodes/children.html" (dict
|
||||
"page" .
|
||||
"containerstyle" "div"
|
||||
"style" "h2"
|
||||
"description" "true"
|
||||
)}}
|
||||
<footer class="footline">
|
||||
{{- partial "content-footer.html" . }}
|
||||
</footer>
|
||||
</article>
|
|
@ -1 +1 @@
|
|||
{{ if (eq .Type "chapter") }}<b style="display: inline-block; font-weight: 200; padding-left: .3rem; text-align: left; width: 1.1rem;">{{ .Params.weight }}.</b> {{ end }}
|
||||
{{ if (or (eq .Type "chapter") (eq .Type "chapter-overview")) }}<b style="display: inline-block; font-weight: 200; padding-left: .3rem; text-align: left; width: 1.1rem;">{{ .Params.weight }}.</b> {{ end }}
|
Loading…
Reference in a new issue