Skip to content

Commit

Permalink
Default pages for various page types
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddenton committed Sep 30, 2024
1 parent 38822cc commit cfa97c8
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/website/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ menus:
weight: 22
- name: learn-tutorials
title: Tutorials
url: /tutorials
url: /tutorial
parent: learn
weight: 23
- name: learn-howto
Expand Down
1 change: 1 addition & 0 deletions src/website/content/how-to/example/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
draft: true
title: Example title
description: Subtitle
layout: how-to
---

Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
draft: true
title: Example tutorial
description: Subtitle
layout: tutorial
---

2 changes: 1 addition & 1 deletion src/website/layouts/_default/list.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{ define "main" }}
<main>
DEFAULT
{{ if or .Title .Content }}
<div>
{{ with .Title }}<h1>{{ . }}</h1>{{ end }}
Expand All @@ -12,5 +13,4 @@
{{ end }}
{{ partial "shared/pagination.html" . }}
</main>
{{ partial "shared/sidebar.html" . }}
{{ end }}
1 change: 0 additions & 1 deletion src/website/layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ <h1>{{ .Title }}</h1>
{{ end }}
</article>
</main>
{{ partial "shared/sidebar.html" . }}
{{ end }}
Empty file.
10 changes: 10 additions & 0 deletions src/website/layouts/how-to/list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{ define "main" }}
<main>
</main>
<aside>
<div>
{{ partial "shared/sidebar.html" (dict "context" . "type" "how-to") }}
</div>
</aside>

{{ end }}
21 changes: 7 additions & 14 deletions src/website/layouts/partials/shared/sidebar.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
<aside>
<div>
<div>
<h3>LATEST POSTS</h3>
</div>
<div>
<ul>
{{ range first 5 (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>
</div>
</div>
</aside>
<div>
<ul>
{{ range where .context.Site.RegularPages "Type" "eq" .type }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>
</div>
11 changes: 11 additions & 0 deletions src/website/layouts/tutorial/list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{ define "main" }}
<main>
tutorial
</main>
<aside>
<div>
{{ partial "shared/sidebar.html" (dict "context" . "type" "tutorial") }}
</div>
</aside>

{{ end }}

0 comments on commit cfa97c8

Please sign in to comment.