From f490174e4b2b9a1dd14d3d4b9e9e4276daa2cbcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Wed, 11 Sep 2024 13:18:03 +0200 Subject: [PATCH] docs: showcase page layout using `type` frontmatter #891 --- exampleSite/archetypes/chapter-overview.md | 7 +++++++ exampleSite/content/shortcodes/_index.en.md | 4 +--- .../chapter-overview/views/article.html | 19 +++++++++++++++++++ exampleSite/layouts/partials/menu-pre.html | 2 +- 4 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 exampleSite/archetypes/chapter-overview.md create mode 100644 exampleSite/layouts/chapter-overview/views/article.html diff --git a/exampleSite/archetypes/chapter-overview.md b/exampleSite/archetypes/chapter-overview.md new file mode 100644 index 0000000000..20619b8ea1 --- /dev/null +++ b/exampleSite/archetypes/chapter-overview.md @@ -0,0 +1,7 @@ ++++ +title = "{{ replace .Name "-" " " | title }}" +type = "chapter-overview" +weight = 1 ++++ + +This is a new chapter. \ No newline at end of file diff --git a/exampleSite/content/shortcodes/_index.en.md b/exampleSite/content/shortcodes/_index.en.md index 21530522e7..77c6a867e9 100644 --- a/exampleSite/content/shortcodes/_index.en.md +++ b/exampleSite/content/shortcodes/_index.en.md @@ -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" %}} diff --git a/exampleSite/layouts/chapter-overview/views/article.html b/exampleSite/layouts/chapter-overview/views/article.html new file mode 100644 index 0000000000..35fc6fd8c2 --- /dev/null +++ b/exampleSite/layouts/chapter-overview/views/article.html @@ -0,0 +1,19 @@ + +
+
+ {{- partial "content-header.html" . }} +
+{{ partial "heading-pre.html" . }}
{{ T "Chapter" .Params.Weight }}
+{{ partial "heading.html" . }}{{ partial "heading-post.html" . }} + +{{ partial "article-content.html" . }} +{{ partial "shortcodes/children.html" (dict + "page" . + "containerstyle" "div" + "style" "h2" + "description" "true" +)}} +
+ {{- partial "content-footer.html" . }} +
+
\ No newline at end of file diff --git a/exampleSite/layouts/partials/menu-pre.html b/exampleSite/layouts/partials/menu-pre.html index eb58e01454..f5ee48b900 100644 --- a/exampleSite/layouts/partials/menu-pre.html +++ b/exampleSite/layouts/partials/menu-pre.html @@ -1 +1 @@ -{{ if (eq .Type "chapter") }}{{ .Params.weight }}. {{ end }} \ No newline at end of file +{{ if (or (eq .Type "chapter") (eq .Type "chapter-overview")) }}{{ .Params.weight }}. {{ end }} \ No newline at end of file