Skip to content
This repository has been archived by the owner on Jul 21, 2019. It is now read-only.

Commit

Permalink
Whitespace cleanup (#148)
Browse files Browse the repository at this point in the history
* Fix some extra whitespace

Signed-off-by: Matt Stratton <[email protected]>

* Only load map array on homepage

Signed-off-by: Matt Stratton <[email protected]>
  • Loading branch information
mattstratton authored Jan 31, 2017
1 parent c4c9aef commit 0e4388d
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 60 deletions.
46 changes: 23 additions & 23 deletions layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@
</div>
{{ $.Scratch.Add "i" 1 }}
<div class="row">
{{ range sort $.Site.Data.events "startdate" }}
{{ if .startdate }}
{{ if ge (dateFormat "2006-01-02" .startdate) (dateFormat "2006-01-02" ($.Now.Format "2006-01-02")) }}
{{- range sort $.Site.Data.events "startdate" -}}
{{- if .startdate -}}
{{- if ge (dateFormat "2006-01-02" .startdate) (dateFormat "2006-01-02" ($.Now.Format "2006-01-02")) -}}
{{ $.Scratch.Set "city" .city }}
{{ $.Scratch.Set "year" .year }}
{{ $.Scratch.Set "logo" "unset" }}
<div class="col-md-3 homepage-grid-col">
<a href = "/events/{{ .name }}">
{{ $.Scratch.Set "subdir" .name }}
{{ $.Scratch.Set "contentdir" (printf "static/events/%s/" ($.Scratch.Get "subdir")) }}
{{ range (readDir "static/events") }}
{{ if eq .Name ($.Scratch.Get "subdir") }}
{{ range (readDir ($.Scratch.Get "contentdir"))}}
{{ if eq .Name "logo-square.png" }}
{{- range (readDir "static/events") -}}
{{- if eq .Name ($.Scratch.Get "subdir") -}}
{{- range (readDir ($.Scratch.Get "contentdir")) -}}
{{- if eq .Name "logo-square.png" -}}
<img src="{{ printf ("/events/%s/logo-square.png") ($.Scratch.Get "subdir")}}" class="img-fluid"/>
{{ $.Scratch.Set "logo" "set" }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ if ne ($.Scratch.Get "logo") "set" }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- if ne ($.Scratch.Get "logo") "set" -}}
<img src="/img/event-logo-default.png" class="img-fluid"/>
{{ end }}
{{- end -}}
</a>
<br/>
<span class = "homepage-grid-date">
Expand All @@ -41,19 +41,19 @@
</span>
<span class="homepage-grid-city">{{ .city }}</span>
<br/>
{{ if .description }}
{{ if ne .description "" }}
{{- if .description -}}
{{- if ne .description "" -}}
<span class="homepage-grid-desc">{{ .description | markdownify }}</span>
{{ end }}
{{ end }}
{{- end -}}
{{- end -}}
</div>
{{ if modBool ($.Scratch.Get "i") 4 }}
{{- if modBool ($.Scratch.Get "i") 4 -}}
</div>
<div class="row">
{{ end }}
{{- end -}}
{{ $.Scratch.Add "i" 1 }}
{{ end }}
{{ end }}
{{ end }}
{{- end -}}
{{- end -}}
{{- end -}}
</div>
{{ end }}
{{- end -}}
5 changes: 3 additions & 2 deletions layouts/partials/footer_scripts.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{ partial "map.html" . }}

{{ if .IsHome }}
{{ partial "map.html" . }}
{{ end }}
<script src="/js/devopsdays-min.js"></script>
<!-- <script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyC1bvNK9qFJGEhoWNbQuojmJJ1Tg0DoOew&callback=initMap">
Expand Down
16 changes: 13 additions & 3 deletions layouts/partials/head.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
{{ .Hugo.Generator }}
{{- partial "meta.html" . -}}
{{ partial "meta.html" . }}
{{ partial "head/seo.html" . }}

<title>
{{ $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" }} {{ if eq $url "/" }} {{ .Site.Title }} {{ else }} {{ if .Params.Heading }} {{ .Params.Heading }} {{ else }} {{ .Title }} {{ end }} {{ end }}
{{- $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" -}}
{{- if eq $url "/" -}}
{{ .Site.Title }}
{{- else -}}
{{- if .Params.Heading -}}
{{ .Params.Heading }}
{{- else -}}
{{ .Title }}
{{- end -}}
{{- end -}}
</title>
<link rel="canonical" href="{{ .Permalink }}">
{{- partial "head_includes.html" . -}}
{{ partial "head_includes.html" . }}
4 changes: 2 additions & 2 deletions layouts/partials/head/seo.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{{ partial "head/seo/open_graph.html" . }}
{{ partial "head/seo/schema.html" . }}
{{- partial "head/seo/open_graph.html" . -}}
{{- partial "head/seo/schema.html" . -}}
40 changes: 15 additions & 25 deletions layouts/partials/head/seo/open_graph.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,33 @@
<meta property="og:description" content="{{ if .Description }}{{ .Description }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ end }}{{ end }}" />
<meta property="og:type" content="{{ if .Params.type }}{{ .Params.type }}{{ else }}website{{ end }}" />
<meta property="og:url" content="{{ .Permalink }}" />
{{ with .Params.images }}{{ range first 1 . }}
{{- with .Params.images -}}{{- range first 1 . -}}
<meta property="og:image" content="{{ . }}" />
{{ end }}{{ end }}
{{- end -}}{{- end -}}

<!-- Optional Open Graph Markup -->
<meta property="og:updated_time" content="{{ .Date }}"/>
{{ 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 . }}
{{- 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="{{ . }}" />
{{ end }}{{ end }}
{{- 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 and (isset .Site.Params "authors") (isset .Params "author") }}
{{- if and (isset .Site.Params "authors") (isset .Params "author") -}}
<!-- Article Specific Open Graph Markup -->
{{ $author := index .Site.Params.authors .Params.author }}
{{- $author := index .Site.Params.authors .Params.author -}}
<meta property="article:author" content="https://www.facebook.com/{{ $author.social.facebook }}" />
{{ end }}
{{- end -}}
<meta property="article:publisher" content="https://www.facebook.com/{{ .Site.Params.social.facebook }}" />
{{if .IsPage}}
{{- if .IsPage -}}
<meta property="article:published_time" content="{{ .Date }}" />
{{ end }}
{{- end -}}
<meta property="article:modified_time" content="{{ .Date }}" />
<meta property="article:section" content="{{ .Section }}" />
{{ with .Params.tags }}{{ range first 6 . }}
{{- with .Params.tags -}}{{- range first 6 . -}}
<meta property="article:tag" content="{{ . }}" />
{{ end }}{{ end }}
{{- end -}}{{- end -}}

<!-- Facebook Page Admin ID for Domain Insights -->
{{ with .Site.Params.social.facebook_admin }}<meta property="fb:admins" content="{{ . }}" />{{ end }}
{{- with .Site.Params.social.facebook_admin -}}<meta property="fb:admins" content="{{ . }}" />{{- end -}}
8 changes: 4 additions & 4 deletions layouts/partials/head/seo/schema.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<meta itemprop="description" content="{{ if .Description }}{{ .Description }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ end }}{{ end }}">

<!-- Output images -->
{{ with .Params.images }}{{ range first 6 . }}
{{- with .Params.images -}}{{- range first 6 . -}}
<meta itemprop="image" content="{{ . }}">
{{ end }}{{ end }}
{{- end -}}{{- end -}}

<!-- Output all taxonomies as schema.org keywords -->
<meta itemprop="keywords" content="{{ range $plural, $terms := .Site.Taxonomies }}{{ range $term, $val := $terms }}{{ printf "%s," $term }}{{ end }}{{ end }}" />

{{if .IsPage}}
{{- if .IsPage -}}
<meta itemprop="wordCount" content="{{ .WordCount }}">
{{ end }}
{{- end -}}
2 changes: 1 addition & 1 deletion layouts/partials/meta.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
{{ if .Site.Params.Description }}<meta name="description" content="{{ .Site.Params.Description }}">{{ end }}
{{- if .Site.Params.Description -}}<meta name="description" content="{{ .Site.Params.Description }}">{{- end -}}

0 comments on commit 0e4388d

Please sign in to comment.