revises layouts

This commit is contained in:
Huy Tran 2018-07-21 17:08:41 +10:00
parent aabdea8e07
commit bb990c4380
10 changed files with 30 additions and 134 deletions

View file

@ -0,0 +1,3 @@
<span style="color:red">
{{ printf "%#v" . }}
</span>

View file

@ -1,8 +1,6 @@
<head>
<link href="http://gmpg.org/xfn/11" rel="profile">
{{ partial "header/meta.html" . }}
{{ "<!-- Web fonts -->" | safeHTML }}
{{ partial "header/fonts.html" . }}
{{ "<!-- Font-Awesome -->" | safeHTML }}
{{ partial "header/font-awesome.html" . }}
{{ "<!-- highlighting -->" | safeHTML }}

View file

@ -14,5 +14,5 @@
<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" . }}
{{ template "_internal/twitter_cards.html" . }}
{{ template "_internal/opengraph.html" . }}

View file

@ -1,32 +0,0 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Cache-Control" content="public" />
<!-- Enable responsiveness on mobile devices -->
<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 }}
<!-- Twitter -->
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="{{.Site.Params.social.twitter}}">
<meta name="twitter:title" content="{{$.Scratch.Get "theTitle"}}">
<meta name="twitter:description" content="{{.Site.Params.meta.description}}">
<meta property="twitter:image" content="{{.Site.Params.authorimage}}">
<meta name="twitter:creator" content="{{.Site.Params.author}}">
<!-- OpenGraph -->
<meta property="og:locale" content="{{.Site.LanguageCode}}">
<meta property="og:type" content="article">
<meta property="og:url" content="{{.Permalink}}">
<meta property="og:image" content="{{.Site.Params.authorimage}}">
<meta property="og:site_name" content="{{.Site.Title}}">
<meta property="og:title" content="{{$.Scratch.Get "theTitle"}}">
<meta property="og:description" content="{{.Site.Params.meta.description}}">
{{ $.Scratch.Delete "theTitle" -}}

View file

@ -1,62 +0,0 @@
<meta property="og:title" content="{{ .Title }}" />
<meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" />
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
<meta property="og:url" content="{{ .Permalink }}" />
{{ with .Params.images -}}
{{- range first 6 . -}}
<meta property="og:image" content="{{ . | absURL }}" />
{{- end -}}
{{- end -}}
{{- if .IsPage -}}
{{ if not .PublishDate.IsZero -}}
<meta property="article:published_time" content="{{ .PublishDate.Format "2006-01-02T15:04:05-07:00" | safeHTML }}"/>
{{- else if not .Date.IsZero -}}
<meta property="article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}"/>
{{- end }}
{{- if not .Lastmod.IsZero -}}
<meta property="article:modified_time" content="{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}"/>
{{- end }}
{{- else -}}
{{ if not .Date.IsZero -}}
<meta property="og:updated_time" content="{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}"/>
{{- end }}
{{- end -}}
{{ with .Params.audio -}}<meta property="og:audio" content="{{ . }}" />{{- end }}
{{ with .Params.locale -}}<meta property="og:locale" content="{{ . }}" />{{- end }}
{{ with .Site.Params.title -}}<meta property="og:site_name" content="{{ . }}" />{{- end }}
{{ with .Params.videos -}}
{{- range . -}}
<meta property="og:video" content="{{ . | absURL }}" />
{{- end -}}
{{- end }}
<!-- If it is part of a series, link to related articles -->
{{- $permalink := .Permalink -}}
{{- $siteSeries := .Site.Taxonomies.series -}}
{{- with .Params.series -}}
{{- range $name := . -}}
{{- $series := index $siteSeries $name -}}
{{- range $page := first 6 $series.Pages -}}
{{ if ne $page.Permalink $permalink -}}
<meta property="og:see_also" content="{{ $page.Permalink }}" />
{{- end }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- if .IsPage -}}
{{- range .Site.Authors -}}
{{ with .Social.facebook -}}
<meta property="article:author" content="https://www.facebook.com/{{ . }}" />
{{- end }}
{{ with .Site.Social.facebook -}}
<meta property="article:publisher" content="https://www.facebook.com/{{ . }}" />
{{- end }}
<meta property="article:section" content="{{ .Section }}" />
{{ with .Params.tags -}}
{{- range first 6 . -}}
<meta property="article:tag" content="{{ . }}" />
{{- end -}}
{{- end }}
{{- end -}}
{{- end -}}
<!-- Facebook Page Admin ID for Domain Insights -->
{{ with .Site.Social.facebook_admin -}}<meta property="fb:admins" content="{{ . }}" />{{- end }}

View file

@ -1,29 +0,0 @@
{{- with $.Params.images -}}
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image" content="{{ index . 0 | absURL }}"/>
{{ else -}}
{{- $images := $.Resources.ByType "image" -}}
{{- $featured := $images.GetMatch "*feature*" -}}
{{- $featured := cond (ne $featured nil) $featured ($images.GetMatch "{*cover*,*thumbnail*}") -}}
{{- with $featured -}}
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image" content="{{ $featured.Permalink }}"/>
{{- else -}}
{{- with $.Site.Params.images -}}
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image" content="{{ index . 0 | absURL }}"/>
{{ else -}}
<meta name="twitter:card" content="summary"/>
{{- end -}}
{{- end -}}
{{- end }}
<meta name="twitter:title" content="{{ .Title }}"/>
<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}"/>
{{ with .Site.Social.twitter -}}
<meta name="twitter:site" content="@{{ . }}"/>
{{ end -}}
{{ range .Site.Authors }}
{{ with .twitter -}}
<meta name="twitter:creator" content="@{{ . }}"/>
{{ end -}}
{{ end -}}

View file

@ -5,15 +5,15 @@
<a href="{{ .RelPermalink }}">
<span class="next__heading">NEXT</span>
<span>{{ .Title }}</span>
<i class="fas fa-chevron-right"></i>
</a>
<i class="fas fa-chevron-right"></i>
{{- end }}
</li>
<li class="post__nav--previous">
{{ with .PrevInSection -}}
<i class="fas fa-chevron-left"></i>
<a href="{{ .RelPermalink }}">
<span class="previous__heading">PREVIOUS</span>
<i class="fas fa-chevron-left"></i>
<span class="previous__title">{{ .Title }}</span>
</a>
{{- end }}

View file

@ -6,8 +6,10 @@
<a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>
</div>
{{ with .Site.Params.authorimage }}
{{ $strippedSlash := ($.Site.Params.authorimage | replaceRE "^(/)+(.*)" "$2") }}
{{ $authorImage := (printf "%s%s" $.Site.BaseURL $strippedSlash) }}
<p>
<img src="/{{.}}" alt="Author Image" class="img--circle img--headshot element--center">
<img src="{{$authorImage}}" alt="Author Image" class="img--circle img--headshot element--center">
</p>
{{ end }}
<p class="site__description">
@ -18,11 +20,12 @@
<p>
{{ partial "sidebar/social.html" . }}
</p>
<p class="copyright">{{ with .Site.Params.copyright }}{{.|safeHTML}}{{ else }}&copy; {{ now.Format "2006"}} {{.Site.Params.author}}.
<p class="copyright">
{{ with .Site.Params.copyright }}{{.|safeHTML}}{{ else }}&copy; {{ now.Format "2006"}} {{.Site.Params.author}}.
<a href="https://creativecommons.org/licenses/by-sa/4.0">Some Rights Reserved</a>.
<br/>Built with
<a href="https://gohugo.io">Hugo</a> ❤️
<a href="https://github.com/htr3n/hyde-hyde">hyde-hyde</a>.{{end}}
<a href="https://gohugo.io">Hugo</a> ❤️ <a href="https://github.com/htr3n/hyde-hyde">hyde-hyde</a>.
{{end}}
</p>
</div>
<div>

View file

@ -0,0 +1,15 @@
<figure {{ with .Get "class" }}class="{{.}}"{{ end }}>
{{ with .Get "link"}}<a href="{{.}}">{{ end }}
<img src="{{ .Get "src" }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}"{{ end }} />
{{ if .Get "link"}}</a>{{ end }}
{{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}}
<figcaption>
{{ with .Get "title" }}
<span class="img--caption">{{ . }}</span>
{{ end }}
{{ with (.Get "caption")}}
<span class="img--caption">{{ . }}</span>
{{ end }}
</figcaption>
{{ end }}
</figure>