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 -}}
{{ define "footer" -}}
<div class="footer content">
<div class="container content">
{{- partial "highlight-js.html" . -}}
{{- partial "commenting.html" . -}}
</div>

View file

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

View file

@ -7,7 +7,6 @@
{{ partial "header/font-awesome.html" . }}
{{ "<!-- highlighting -->" | safeHTML }}
{{ 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/hyde-hyde.css">
{{ `<!-- 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 }}
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
{{ .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/opengraph.html" . }}

View file

@ -8,7 +8,7 @@
{{ $.Scratch.Set "theTitle" .Site.Title -}}
{{else}}
{{ $.Scratch.Add "theTitle" .Title}}
{{ $.Scratch.Add "theTitle" "·"}}
{{ $.Scratch.Add "theTitle" ""}}
{{ $.Scratch.Add "theTitle" .Site.Title}}
{{- end -}}
<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">
{{- with .Data.Pages -}}
{{ partial "posts-list.html" . }}

View file

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

View file

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

View file

@ -1,13 +1,22 @@
<div class="page__nav">
<hr>
<span class="pull-right">
{{ with .Prev -}}
<span>Next: <a href="{{ .RelPermalink }}">{{ .Title }}</a></span>
{{- end }}
</span>
<span>
{{ with .Next -}}
<span>Previous: <a href="{{ .RelPermalink }}">{{ .Title }}</a></span>
{{- end }}
</span>
</div>
<div>
<ul class="post__nav">
<li class="post__nav--next">
{{ with .NextInSection -}}
<a href="{{ .RelPermalink }}">
<span class="next__heading">NEXT</span>
<span>{{ .Title }}</span>
<i class="fas fa-chevron-right"></i>
</a>
{{- end }}
</li>
<li class="post__nav--previous">
{{ 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 }}
<div>
<span class="text-left meta">
<div class="post__meta">
<!-- 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") -}}
{{ end }}
{{- end }}
<!-- categories -->
{{ with .Params.categories }}
{{ $total := len . }}
{{ if gt $total 0 }}
{{- with .Params.categories -}}
{{- $total := len . -}}
{{ if gt $total 0 -}}
in
{{ $total := sub $total 1 }}
{{ range $i, $cat := sort . }}
<a class="meta" href="{{ "/categories/" | relURL }}{{ $cat | urlize }}">{{ $cat | upper }}</a>
{{- $total := sub $total 1 -}}
{{- range $i, $cat := sort . }}
<a class="post__category" href="{{ "/categories/" | relURL }}{{ $cat | urlize }}">{{ $cat | upper }}</a>
{{ if lt $i $total }},{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{- end -}}
{{- end -}}
{{- end -}}
<!-- tags -->
{{ with .Params.tags }}
{{ $total := len . }}
{{ if gt $total 0 }}
<br/>
{{ $subtotal := sub $total 1 }} <i class="fas fa-tags"></i>
{{ range $i, $tag := sort . }}
<a class="tag" href="{{ "/tags/" | relURL }}{{ $tag | urlize }}">#{{ $tag | lower }}</a>
{{ range $i, $tag := . }}
<a class="post__tag" href="{{ "/tags/" | relURL }}{{ $tag | urlize }}">#{{ $tag | lower }}</a>
{{ if lt $i $subtotal }} {{ end }}
{{ end }}
{{ end }}
{{ end }}
<br/>
<i class="fas fa-clock"></i> {{ .ReadingTime }} min read
</span>
</div>
{{ end }}

View file

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

View file

@ -3,7 +3,7 @@
<span class="list__title--small">
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
{{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}}
</span>
</li>

View file

@ -1,13 +1,16 @@
<!-- Sidebar -->
<div class="sidebar">
<div class="container text-center {{ with .Site.Params.sidebarSticky }}sidebar-sticky{{ end }}">
<div class="sidebar-about text-center">
<a href="{{ .Site.BaseURL }}">
<h1 class="brand">{{ .Site.Title }}</h1>
</a>
<div class="sidebar text-center">
<div class="container {{ with .Site.Params.sidebarSticky -}}sidebar-sticky{{- end }}">
<div class="sidebar-about">
<div class="site__title">
<a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>
</div>
{{ with .Site.Params.authorimage }}
<img src="/{{.}}" alt="Author Image" class="img-circle headshot center"> {{ end }}
<p class="lead">
<p>
<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}}
</p>
</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 }}