refactors/revises theme layouts

This commit is contained in:
Huy Tran 2018-07-21 06:32:00 +10:00
parent f1605d3802
commit 5701197651
15 changed files with 80 additions and 55 deletions

View file

@ -7,7 +7,7 @@
{{- end -}} {{- end -}}
{{ define "footer" -}} {{ define "footer" -}}
<div class="footer content"> <div class="container content">
{{- partial "highlight-js.html" . -}} {{- partial "highlight-js.html" . -}}
{{- partial "commenting.html" . -}} {{- partial "commenting.html" . -}}
</div> </div>

View file

@ -3,15 +3,15 @@
{{- end }} {{- end }}
{{ define "content" -}} {{ define "content" -}}
<div class="posts"> <div class="post-list">
{{ range (where .Data.Pages "Type" "not in" (slice "about" "portfolio")).GroupBy "Section" -}} {{ range (where .Data.Pages "Type" "not in" (slice "about" "portfolio")).GroupBy "Section" -}}
{{ range .Pages }} {{ range .Pages }}
<div class="post"> <div class="post-list__item">
<span class="list__title--big"> <span class="item__title--big">
<a href="{{ .RelPermalink }}">{{ .Title }}</a>{{ if .Draft }}<sup> <i class="fas fa-pen-square fa-xs"></i></sup>{{ end }} <a href="{{ .RelPermalink }}">{{ .Title }}</a>{{ if .Draft }}<sup> <i class="fas fa-pen-square fa-xs"></i></sup>{{ end }}
</span> </span>
<span class="title__date"> <span class="item__date">
<i class="fas fa-calendar-alt"></i> {{ .Date.Format (.Site.Params.dateformat | default "Jan 02, 2006") }} {{ .Date.Format (.Site.Params.dateformat | default "Jan 02, 2006") }}
</span> </span>
{{ .Summary }} {{ .Summary }}
{{ if .Truncated -}} {{ if .Truncated -}}

View file

@ -1,11 +1,7 @@
{{- if and (not .Site.BuildDrafts) (ne .Params.showcomments false) -}} {{- if ne .Params.showcomments false -}}
{{ if .Site.DisqusShortname -}} {{ if .Site.DisqusShortname -}}
<hr>
<h2>Comments</h2>
{{- partial "commenting/disqus.html" . -}} {{- partial "commenting/disqus.html" . -}}
{{- else if .Site.Params.GraphCommentId -}} {{- else if .Site.Params.GraphCommentId -}}
<hr>
<h2>Comments</h2>
{{- partial "commenting/graphcomment.html" . -}} {{- partial "commenting/graphcomment.html" . -}}
{{- end -}} {{- end -}}
{{- end }} {{- end }}

View file

@ -7,7 +7,6 @@
{{ partial "header/font-awesome.html" . }} {{ partial "header/font-awesome.html" . }}
{{ "<!-- highlighting -->" | safeHTML }} {{ "<!-- highlighting -->" | safeHTML }}
{{ partial "header/highlight-css.html" . }} {{ partial "header/highlight-css.html" . }}
<link rel="stylesheet" href="{{ .Site.BaseURL }}/css/poole.css">
<link rel="stylesheet" href="{{ .Site.BaseURL }}/css/print.min.css" media="print"> <link rel="stylesheet" href="{{ .Site.BaseURL }}/css/print.min.css" media="print">
<link rel="stylesheet" href="{{ .Site.BaseURL }}/css/hyde-hyde.css"> <link rel="stylesheet" href="{{ .Site.BaseURL }}/css/hyde-hyde.css">
{{ `<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> {{ `<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->

View file

@ -4,5 +4,15 @@
{{ "<!-- Enable responsiveness on mobile devices -->" | safeHTML }} {{ "<!-- Enable responsiveness on mobile devices -->" | safeHTML }}
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
{{ .Hugo.Generator }} {{ .Hugo.Generator }}
{{- if .IsHome }}
{{ $.Scratch.Set "theTitle" .Site.Title -}}
{{else}}
{{ $.Scratch.Add "theTitle" .Title}}
{{ $.Scratch.Add "theTitle" " • "}}
{{ $.Scratch.Add "theTitle" .Site.Title}}
{{- end -}}
<title>{{ $.Scratch.Get "theTitle" }}</title>
{{ with .Site.Params.meta.description -}}<meta name="description" content="{{ . }}">{{- end }}
{{ with .Site.Params.meta.keywords -}}<meta name="keywords" content="{{.}}">{{- end }}
{{ partial "header/twitter_cards.html" . }} {{ partial "header/twitter_cards.html" . }}
{{ partial "header/opengraph.html" . }} {{ partial "header/opengraph.html" . }}

View file

@ -8,7 +8,7 @@
{{ $.Scratch.Set "theTitle" .Site.Title -}} {{ $.Scratch.Set "theTitle" .Site.Title -}}
{{else}} {{else}}
{{ $.Scratch.Add "theTitle" .Title}} {{ $.Scratch.Add "theTitle" .Title}}
{{ $.Scratch.Add "theTitle" "·"}} {{ $.Scratch.Add "theTitle" ""}}
{{ $.Scratch.Add "theTitle" .Site.Title}} {{ $.Scratch.Add "theTitle" .Site.Title}}
{{- end -}} {{- end -}}
<title>{{ $.Scratch.Get "theTitle" }}</title> <title>{{ $.Scratch.Get "theTitle" }}</title>

View file

@ -1,4 +1,4 @@
<h1 class="title">{{ .Title }}</h1> <span class="section__title">{{ .Title }}</span>
<ul class="posts"> <ul class="posts">
{{- with .Data.Pages -}} {{- with .Data.Pages -}}
{{ partial "posts-list.html" . }} {{ partial "posts-list.html" . }}

View file

@ -13,4 +13,4 @@
</div> </div>
{{ partial "post-meta-after.html" . }} {{ partial "post-meta-after.html" . }}
{{ partial "post-related.html" . }} {{ partial "post-related.html" . }}
</article> </article>

View file

@ -1,5 +1,5 @@
<div class="portfolio-content portfolio-container"> <div class="portfolio-content portfolio-container">
<h1 class="title">{{ .Title }}</h1> <span class="section__title">{{ .Title }}</span>
{{ range where .Data.Pages "Params.featured" "==" "true" }} {{ range where .Data.Pages "Params.featured" "==" "true" }}
<section class="latest section"> <section class="latest section">
<div class="section-inner"> <div class="section-inner">

View file

@ -1,13 +1,22 @@
<div class="page__nav"> <div>
<hr> <ul class="post__nav">
<span class="pull-right"> <li class="post__nav--next">
{{ with .Prev -}} {{ with .NextInSection -}}
<span>Next: <a href="{{ .RelPermalink }}">{{ .Title }}</a></span> <a href="{{ .RelPermalink }}">
{{- end }} <span class="next__heading">NEXT</span>
</span> <span>{{ .Title }}</span>
<span> <i class="fas fa-chevron-right"></i>
{{ with .Next -}} </a>
<span>Previous: <a href="{{ .RelPermalink }}">{{ .Title }}</a></span> {{- end }}
{{- end }} </li>
</span> <li class="post__nav--previous">
</div> {{ with .PrevInSection -}}
<a href="{{ .RelPermalink }}">
<span class="previous__heading">PREVIOUS</span>
<i class="fas fa-chevron-left"></i>
<span class="previous__title">{{ .Title }}</span>
</a>
{{- end }}
</li>
</ul>
</div>

View file

@ -1,36 +1,34 @@
{{ if ne .Params.showpagemeta false }} {{ if ne .Params.showpagemeta false }}
<div> <div class="post__meta">
<span class="text-left meta">
<!-- published date --> <!-- published date -->
{{ if not .Date.IsZero }} {{ if not .Date.IsZero -}}
<i class="fas fa-calendar-alt"></i> {{ .Date.Format (.Site.Params.dateformat | default "Jan 02, 2006") -}} <i class="fas fa-calendar-alt"></i> {{ .Date.Format (.Site.Params.dateformat | default "Jan 02, 2006") -}}
{{ end }} {{- end }}
<!-- categories --> <!-- categories -->
{{ with .Params.categories }} {{- with .Params.categories -}}
{{ $total := len . }} {{- $total := len . -}}
{{ if gt $total 0 }} {{ if gt $total 0 -}}
in in
{{ $total := sub $total 1 }} {{- $total := sub $total 1 -}}
{{ range $i, $cat := sort . }} {{- range $i, $cat := sort . }}
<a class="meta" href="{{ "/categories/" | relURL }}{{ $cat | urlize }}">{{ $cat | upper }}</a> <a class="post__category" href="{{ "/categories/" | relURL }}{{ $cat | urlize }}">{{ $cat | upper }}</a>
{{ if lt $i $total }},{{ end }} {{ if lt $i $total }},{{ end }}
{{ end }} {{- end -}}
{{ end }} {{- end -}}
{{ end }} {{- end -}}
<!-- tags --> <!-- tags -->
{{ with .Params.tags }} {{ with .Params.tags }}
{{ $total := len . }} {{ $total := len . }}
{{ if gt $total 0 }} {{ if gt $total 0 }}
<br/> <br/>
{{ $subtotal := sub $total 1 }} <i class="fas fa-tags"></i> {{ $subtotal := sub $total 1 }} <i class="fas fa-tags"></i>
{{ range $i, $tag := sort . }} {{ range $i, $tag := . }}
<a class="tag" href="{{ "/tags/" | relURL }}{{ $tag | urlize }}">#{{ $tag | lower }}</a> <a class="post__tag" href="{{ "/tags/" | relURL }}{{ $tag | urlize }}">#{{ $tag | lower }}</a>
{{ if lt $i $subtotal }} {{ end }} {{ if lt $i $subtotal }} {{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}
<br/> <br/>
<i class="fas fa-clock"></i> {{ .ReadingTime }} min read <i class="fas fa-clock"></i> {{ .ReadingTime }} min read
</span>
</div> </div>
{{ end }} {{ end }}

View file

@ -2,7 +2,6 @@
<!-- related content --> <!-- related content -->
{{ $related := .Site.RegularPages.Related . | first 5 }} {{ $related := .Site.RegularPages.Related . | first 5 }}
{{ with $related }} {{ with $related }}
<hr>
<h2>Related Articles</h2> <h2>Related Articles</h2>
<ul class="related-posts"> <ul class="related-posts">
{{ partial "posts-list.html" . }} {{ partial "posts-list.html" . }}

View file

@ -3,7 +3,7 @@
<span class="list__title--small"> <span class="list__title--small">
<a href="{{ .RelPermalink }}">{{ .Title }}</a> <a href="{{ .RelPermalink }}">{{ .Title }}</a>
{{if not .Date.IsZero}} {{if not .Date.IsZero}}
<time class="list__date pull-right hidden-tablet">{{.Date.Format ("Jan 02 '06")}}</time> <time class="pull-right hidden-tablet">{{.Date.Format ("Jan 02 '06")}}</time>
{{end}} {{end}}
</span> </span>
</li> </li>

View file

@ -1,13 +1,16 @@
<!-- Sidebar --> <!-- Sidebar -->
<div class="sidebar"> <div class="sidebar text-center">
<div class="container text-center {{ with .Site.Params.sidebarSticky }}sidebar-sticky{{ end }}"> <div class="container {{ with .Site.Params.sidebarSticky -}}sidebar-sticky{{- end }}">
<div class="sidebar-about text-center"> <div class="sidebar-about">
<a href="{{ .Site.BaseURL }}"> <div class="site__title">
<h1 class="brand">{{ .Site.Title }}</h1> <a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>
</a> </div>
{{ with .Site.Params.authorimage }} {{ with .Site.Params.authorimage }}
<img src="/{{.}}" alt="Author Image" class="img-circle headshot center"> {{ end }} <p>
<p class="lead"> <img src="/{{.}}" alt="Author Image" class="img--circle img--headshot element--center">
</p>
{{ end }}
<p class="site__description">
{{ with .Site.Params.description }} {{.}} {{ else }} Your site's description {{end}} {{ with .Site.Params.description }} {{.}} {{ else }} Your site's description {{end}}
</p> </p>
</div> </div>

View file

@ -0,0 +1,11 @@
{{ define "header" -}}
{{ partial "header.html" . }}
{{- end -}}
{{ define "content" -}}
{{ partial "portfolio/content.html" . }}
{{- end -}}
{{ define "footer" -}}
{{ partial "footer.html" . }}
{{- end }}