Skip to content

Commit 5cac9ce

Browse files
author
willitcode
committed
make content max-width wider
1 parent ffc89c1 commit 5cac9ce

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed

layouts/_default/list.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{{ define "main" }}
2+
<article class="pa3 pa4-ns nested-copy-line-height">
3+
<section class="cf ph3 ph5-l pv3 pv4-l f4 tc-l center mw8 lh-copy {{ $.Param "text_color" | default "mid-gray" }}">
4+
{{- .Content -}}
5+
</section>
6+
<section class="flex-ns flex-wrap justify-around mt5">
7+
{{ range .Paginator.Pages }}
8+
<div class="relative w-100 w-30-l mb4 bg-white">
9+
{{ .Render "summary" }}
10+
</div>
11+
{{ end }}
12+
</section>
13+
{{- template "_internal/pagination.html" . -}}
14+
</article>
15+
{{ end }}

layouts/index.html

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{{ define "main" }}
2+
<article class="cf ph3 ph5-l pv3 pv4-l f4 tc-l center mw8 lh-copy {{ $.Param "text_color" | default "mid-gray" }}">
3+
{{ .Content }}
4+
</article>
5+
{{/* Define a section to pull recent posts from. 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+
8+
{{/* Check to see if the section is defined for ranging through it */}}
9+
{{range ($mainSections)}}
10+
{{/* Derive the section name */}}
11+
{{ $section_name := . }}
12+
{{/* Create a variable with that section to use in multiple places. */}}
13+
{{ $section := where $.Site.RegularPages "Section" "in" $section_name }}
14+
{{ $section_count := len $section }}
15+
{{ if ge $section_count 1 }}
16+
<div class="pa3 pa4-ns w-100 w-70-ns center">
17+
{{/* Use $section_name to get the section title. Use "with" to only show it if it exists */}}
18+
{{ with $.Site.GetPage "section" $section_name }}
19+
<h1 class="flex-none">
20+
{{ $.Param "recent_copy" | default (i18n "recentTitle" .) }}
21+
</h1>
22+
{{ end }}
23+
24+
{{ $n_posts := $.Param "recent_posts_number" | default 3 }}
25+
26+
<section class="w-100 mw8">
27+
{{/* Range through the first $n_posts items of the section */}}
28+
{{ range (first $n_posts $section) }}
29+
<div class="relative w-100 mb4">
30+
{{ .Render "summary-with-image" }}
31+
</div>
32+
{{ end }}
33+
</section>
34+
35+
{{ if ge $section_count (add $n_posts 1) }}
36+
<section class="w-100">
37+
<h1 class="f3">{{ i18n "more" }}</h1>
38+
{{/* Now, range through the next four after the initial $n_posts items. Nest the requirements, "after" then "first" on the outside */}}
39+
{{ range (first 4 (after $n_posts $section)) }}
40+
<h2 class="f5 fw4 mb4 dib {{ cond (eq $.Site.Language.LanguageDirection "rtl") "ml3" "mr3" }}">
41+
<a href="{{ .RelPermalink }}" class="link black dim">
42+
{{ .Title }}
43+
</a>
44+
</h2>
45+
{{ end }}
46+
47+
{{/* As above, Use $section_name to get the section title, and URL. Use "with" to only show it if it exists */}}
48+
{{ with $.Site.GetPage "section" $section_name }}
49+
<a href="{{ .RelPermalink }}" class="link db f6 pa2 br3 bg-mid-gray white dim w4 tc">{{ i18n "allTitle" . }}</a>
50+
{{ end }}
51+
</section>
52+
{{ end }}
53+
54+
</div>
55+
{{ end }}
56+
{{ end }}
57+
{{end}}
58+

0 commit comments

Comments
 (0)