Improve semantic layout

This commit is contained in:
vimux 2018-11-14 13:34:07 -05:00
parent 1665f619df
commit cdc13f1bf7
No known key found for this signature in database
GPG key ID: 5A34FDC4EE832E34
5 changed files with 52 additions and 44 deletions

View file

@ -1,7 +1,9 @@
{{ define "main" }} {{ define "main" }}
<div class="page404 block center"> <main class="main">
<h1 class="page404__title">{{ T "page404_title" }}</h1> <div class="page404 block center">
<p class="page404__lead">{{ T "page404_lead" }}</p> <h1 class="page404__title">{{ T "page404_title" }}</h1>
<a class="page404__link" href="">{{ T "page404_link" }}</a> <p class="page404__lead">{{ T "page404_lead" }}</p>
</div> <a class="page404__link" href="">{{ T "page404_link" }}</a>
</div>
</main>
{{ end }} {{ end }}

View file

@ -26,7 +26,7 @@
</head> </head>
<body> <body>
{{ partial "header" . }} {{ partial "header" . }}
<div class="main"> <div class="primary">
{{ block "main" . }} {{ block "main" . }}
{{- if or .Title .Content }} {{- if or .Title .Content }}
<div class="page block"> <div class="page block">

View file

@ -1,10 +1,12 @@
{{ define "main" }} {{ define "main" }}
<div class="cards"> <main class="main">
{{ range .Paginator.Pages }} <div class="cards">
<div class="card{{ if $.Param "cardsPerRow" }} card--{{ $.Param "cardsPerRow" }}col{{ else }} card--2col{{ end }}"> {{ range .Paginator.Pages }}
{{ .Render "summary" }} <div class="card{{ if $.Param "cardsPerRow" }} card--{{ $.Param "cardsPerRow" }}col{{ else }} card--2col{{ end }}">
</div> {{ .Render "summary" }}
{{ end }} </div>
</div> {{ end }}
</div>
</main>
{{ partial "pagination.html" . }} {{ partial "pagination.html" . }}
{{ end }} {{ end }}

View file

@ -1,19 +1,21 @@
{{ define "main" }} {{ define "main" }}
<div class="single block"> <main class="main">
<article class="post"> <div class="single block">
{{- partial "post_thumbnail.html" (dict "page" . ) }} <article class="post">
<div class="post__meta meta mb">{{ partial "post_meta.html" . }}</div> {{- partial "post_thumbnail.html" (dict "page" . ) }}
<h1 class="post__title">{{ .Title }}</h1> <div class="post__meta meta mb">{{ partial "post_meta.html" . }}</div>
{{- partial "post_toc.html" . }} <h1 class="post__title">{{ .Title }}</h1>
<div class="post__content">{{ .Content }}</div> {{- partial "post_toc.html" . }}
{{ if or (.Param "share") (isset $.Params "tags") }} <div class="post__content">{{ .Content }}</div>
<footer class="post__footer"> {{ if or (.Param "share") (isset $.Params "tags") }}
{{ partial "post_tags.html" . }} <footer class="post__footer">
{{ partial "post_share.html" . }} {{ partial "post_tags.html" . }}
</footer> {{ partial "post_share.html" . }}
{{ end }} </footer>
</article> {{ end }}
</div> </article>
</div>
</main>
{{ partial "related.html" . }} {{ partial "related.html" . }}
{{ partial "comments.html" . }} {{ partial "comments.html" . }}
{{ end }} {{ end }}

View file

@ -1,20 +1,22 @@
{{ define "main" }} {{ define "main" }}
<div class="cards"> <main class="main">
{{ $mainSections := .Site.Params.mainSections | default (slice "post") }} <div class="cards">
{{ $paginator := .Paginate ( where .Data.Pages "Section" "in" $mainSections ) }} {{ $mainSections := .Site.Params.mainSections | default (slice "post") }}
{{ range $paginator.Pages }} {{ $paginator := .Paginate ( where .Data.Pages "Section" "in" $mainSections ) }}
<div class="card{{ if $.Param "cardsPerRow" }} card--{{ $.Param "cardsPerRow" }}col{{ else }} card--2col{{ end }}"> {{ range $paginator.Pages }}
{{ .Render "summary" }} <div class="card{{ if $.Param "cardsPerRow" }} card--{{ $.Param "cardsPerRow" }}col{{ else }} card--2col{{ end }}">
{{ .Render "summary" }}
</div>
{{ end }}
</div> </div>
{{ end }} {{- if eq $paginator.TotalNumberOfElements 0 }}
</div> <div class="empty block center">
{{- if eq $paginator.TotalNumberOfElements 0 }} <div class="empty__icon">¯\_(ツ)_/¯</div>
<div class="empty block center"> <h3 class="empty__title">{{ T "empty_title" }}</h3>
<div class="empty__icon">¯\_(ツ)_/¯</div> <p class="empty__text">{{ T "empty_text_start" | safeHTML }} ({{ delimit (apply $mainSections "printf" "<code>content/%s</code>" ".") ", " | safeHTML }}), {{ T "empty_text_end" }}.</p>
<h3 class="empty__title">{{ T "empty_title" }}</h3> <p class="empty__tip">{{ T "empty_tip" | safeHTML }}</p>
<p class="empty__text">{{ T "empty_text_start" | safeHTML }} ({{ delimit (apply $mainSections "printf" "<code>content/%s</code>" ".") ", " | safeHTML }}), {{ T "empty_text_end" }}.</p> </div>
<p class="empty__tip">{{ T "empty_tip" | safeHTML }}</p> {{- end }}
</div> </main>
{{- end }}
{{ partial "pagination.html" . }} {{ partial "pagination.html" . }}
{{ end }} {{ end }}