Commit 9d99f902 authored by Laura Kalbag's avatar Laura Kalbag
Browse files

Fix homepage not rendering latest photo and note

By replacing the use of .Data.Pages with .Site.RegularPages
parent 72ebb940
{{ define "main" }}
<section class="intro">
<div class="entry-content">
{{ .Content }}
</div>
</section>
{{/* Define a section to pull recent posts from. For Hugo 0.20 this will default to the section with the most number of pages. */}}
{{ $mainSections := .Site.Params.mainSections | default (slice "post") }}
{{/* Create a variable with that section to use in multiple places. */}}
{{ $section := where .Site.RegularPages "Section" "in" $mainSections }}
{{/* Check to see if the section is defined for ranging through it */}}
{{ $section_count := len $section }}
{{ if ge $section_count 1 }}
{{/* Derive the section name */}}
{{ $section_name := index (.Site.Params.mainSections) 0 }}
<section class="intro">
<div class="entry-content">
{{ .Content }}
</div>
</section>
{{/* Define a section to pull recent posts from. For Hugo 0.20 this will default to the section with the most number of pages. */}} {{ $mainSections := .Site.Params.mainSections | default (slice "post") }} {{/* Create a variable with that section to use
in multiple places. */}} {{ $section := where .Site.RegularPages "Section" "in" $mainSections }} {{/* Check to see if the section is defined for ranging through it */}} {{ $section_count := len $section }} {{ if ge $section_count 1 }} {{/* Derive the
section name */}} {{ $section_name := index (.Site.Params.mainSections) 0 }}
<section class="latest">
{{/* Use $section_name to get the section title. Use "with" to only show it if it exists */}}
{{ with .Site.GetPage "section" $section_name }}
<h2>Recent blog posts</h2>
{{ end }}
<section class="latest">
{{/* Use $section_name to get the section title. Use "with" to only show it if it exists */}} {{ with .Site.GetPage "section" $section_name }}
<h2>Recent blog posts</h2>
{{ end }}
<ul class="posts-list">
{{ range (first 3 $section) }}
<li class="post">
<h3>
<a href="{{ .Permalink }}">
<ul class="posts-list">
{{ range (first 3 $section) }}
<li class="post">
<h3>
<a href="{{ .Permalink }}">
{{- .Title -}}
</a>
</h3>
{{ partial "summary.html" . }}
</li>
{{ end }}
</ul>
</section>
</h3>
{{ partial "summary.html" . }}
</li>
{{ end }}
</ul>
</section>
{{ end }}
<section class="latest">
{{ range first 1 (where .Data.Pages "Section" "notes") }}
<h2>Latest Note</h2>
<div class="note">
<h3>
<a href="{{ .Permalink }}">
{{ end }}
<section class="latest">
{{ range first 1 (where .Site.RegularPages "Section" "notes") }}
<h2>Latest Note</h2>
<div class="note">
<h3>
<a href="{{ .Permalink }}">
{{- .Title -}}
</a>
</h3>
{{ partial "summary.html" . }}
</div>
{{ end }}
</section>
<section class="latest">
{{ range first 1 (where .Data.Pages "Section" "photos") }}
<h2>Latest Photo</h2>
<div class="photo">
{{ partial "summary-photo.html" . }}
</div>
{{ end }}
</section>
{{ end }}
</h3>
{{ partial "summary.html" . }}
</div>
{{ end }}
</section>
<section class="latest">
{{ range first 1 (where .Site.RegularPages "Section" "photos") }}
<h2>Latest Photo</h2>
<div class="photo">
{{ partial "summary-photo.html" . }}
</div>
{{ end }}
</section>
{{ end }}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment