Skip to content

Commit 4bf13cd

Browse files
author
Bud Parr
authored
Merge pull request #7 from budparr/dev
Improve home page posts
2 parents ed54c52 + 3e722a9 commit 4bf13cd

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

exampleSite/config.toml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ title = "Notre-Dame de Paris"
22
baseURL = "https://example.com"
33
languageCode = "en-us"
44
theme = "gohugo-theme-ananke"
5+
themesDir = "../.."
56

67
MetaDataFormat = "yaml"
78
DefaultContentLanguage = "en"

layouts/index.html

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
<main class="cf ph3 ph5-l pv3 pv4-l f4 tc-l center measure-wide lh-copy mid-gray">
33
{{ .Content }}
44
</main>
5-
{{/* Create a variable to use the same section twice. Note that we've included the date here. */}}
6-
{{ $section := where .Data.Pages.ByDate.Reverse "Section" "post" }}
5+
{{/* For Hugo 0.20 this will default to the section with the most number of pages. */}}
6+
{{ $mainSections := .Site.Params.mainSections | default (slice "post") }}
7+
{{/* Create a variable to use the same section twice. */}}
8+
{{ $section := where .Site.RegularPages "Section" "in" $mainSections }}
79
{{ if $section }}
810
<div class="pa3 pa4-ns w-100 w-70-ns center">
911

@@ -14,15 +16,15 @@ <h1 class="flex-none">
1416
<section class="w-100 mw8">
1517
{{ range (first 3 $section) }}
1618
<div class="relative w-100 mb4">
17-
{{ .Render "summary-with-image" }}
19+
{{ partial "summary-with-image.html" . }}
1820
</div>
1921
{{ end }}
2022
</section>
2123

2224
<section class="w-100">
2325
<h1 class="f3">More Posts</h1>
2426
{{/* Nest the requirements, "after" then "first" on the outside */}}
25-
{{ range (first 4 (after 1 $section)) }}
27+
{{ range (first 4 (after 3 $section)) }}
2628
<h2 class="f5 fw4 mb4 dib mr3">
2729
<a href="{{ .URL }}" class="link black dim">
2830
{{ .Title }}
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<article class="bb b--black-10">
2+
<a class="db pv4 ph3 ph0-l no-underline dark-gray dim" href="{{ .URL }}">
3+
<div class="flex flex-column flex-row-ns">
4+
{{ if .Params.featured_image }}
5+
<div class="pr3-ns mb4 mb0-ns w-100 w-40-ns">
6+
<img src="{{ .Params.featured_image }}" class="db" alt="image from {{ .Title }}">
7+
</div>
8+
{{ end }}
9+
<div class="w-100{{ if .Params.featured_image }} w-60-ns pl3-ns{{ end }}">
10+
<h1 class="f3 fw1 athelas mt0 lh-title">{{ .Title }}</h1>
11+
<p class="f6 f5-l lh-copy">
12+
{{ .Summary }}
13+
</p>
14+
{{/* TODO: add author
15+
<p class="f6 lh-copy mv0">By {{ .Author }}</p> */}}
16+
</div>
17+
</div>
18+
</a>
19+
</article>

0 commit comments

Comments
 (0)