Unverified Commit 21a0d232 authored by Ethan Madison's avatar Ethan Madison
Browse files

Replace quotation notation for params

Hugo v0.18 lowercases all params internally, so accessing parameters by
quotation notation (i.e., "exampleParam") is sometimes broken. As such,
it will no longer be used.

This notation was commonly used like '{{ if isset "exampleParam" }}',
which can actually be replaced by '{{ if exampleParam }}' or {{ with
exampleParam }}'. The latter form is preferred since 'with' can reduce
redundancy.

This commit replaces all instances of "quotation notation" with a "dot
notation" friendly equivalence: 'with' where applicable and 'if'
otherwise.

Uses parts from key-amb/hugo-theme-bootie-docs #19:
https://github.com/key-amb/hugo-theme-bootie-docs/pull/19

.
Signed-off-by: default avatarEthan Madison <ethan@ethanmad.com>
parent e8bbfaef
......@@ -12,7 +12,7 @@
<meta name="theme-color" content="{{ . }}" />
{{ end }}
<!--<link href="http://fonts.googleapis.com/css?family=PT+Sans:400,700" rel="stylesheet" type="text/css">-->
<link rel="stylesheet" href="{{ $baseUrl }}/css/highlight/{{ if isset .Site.Params "highlightStyle" }}{{ .Site.Params.highlightStyle }}{{ else }}default{{ end }}.css">
<link rel="stylesheet" href="{{ $baseUrl }}/css/highlight/{{ if .Site.Params.highlightStyle }}{{ .Site.Params.highlightStyle }}{{ else }}default{{ end }}.css">
<link rel="stylesheet" href="{{ $baseUrl }}/css/bootstrap.min.css">
<link rel="stylesheet" href="{{ $baseUrl }}/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="{{ $baseUrl }}/css/theme.css">
......@@ -37,14 +37,14 @@
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li {{ if eq $isHomePage true }}class="active"{{ end }}><a href="{{ $baseUrl }}/">Home</a></li>
{{ if isset .Site.Params "mainMenu" }}
{{ if .Site.Params.mainMenu }}
{{ $url := .Permalink }}
{{ range $menu := .Site.Params.mainMenu }}
{{ $itemUrl := printf "%s/%s/" $baseUrl $menu.link }}
<li {{ if eq $url $itemUrl }}class="active"{{ end }}><a href="{{ $baseUrl }}/{{ $menu.link }}">{{ $menu.name }}</a></li>
{{ end }}
{{ end }}
{{ if isset .Site.Params "noCategoryLink" }}{{ else }}
{{ if .Site.Params.noCategoryLink }}{{ else }}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Categories<span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
......
{{ $isHomePage := eq .Title .Site.Title }}
{{ $baseUrl := .Site.BaseURL }}
<div class="jumbotron" style="background-image: url({{ if isset .Params "image" }}{{ .Params.image }}{{ else }}{{ with .Site.Params.image }}{{ if $isHomePage }}{{ . }}{{ else }}{{ $baseUrl }}/{{ . }}{{ end }}{{ end }}{{ end }});">
<div class="jumbotron" style="background-image: url({{ with .Params.image }}{{ . }}{{ else }}{{ with .Site.Params.image }}{{ $baseUrl }}/{{ . }}{{ end }}{{ end }});">
<div class="container">
<h1>{{ if $isHomePage }}{{ .Site.Title }}{{ else }}{{ .Title }}{{ end }}</h1>
<p>{{ if $isHomePage }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ else }}{{ with .Params.description }}{{ . }}{{ end }}{{ end }}</p>
......
......@@ -2,7 +2,7 @@
{{ $url := .Permalink }}
<div class="col-sm-3 col-sm-offset-1 doc-sidebar">
<div id="sidebar">
{{ if isset .Site.Params "practiceTimes" }}
{{ if .Site.Params.practiceTimes }}
<div class="sidebar-module">
<h4 class="sidebar-heading">Practice</h4>
{{ with .Site.Params.practiceTimes.sunday }}<strong>Sundays</strong>: {{ . }}<br>{{ end }}
......
......@@ -3,7 +3,7 @@
<i class="fa fa-facebook" alt="@{{ . }} on Facebook" title="See us at @{{ . }} on Facebook" aria-hidden="true"></i>
</a>
{{ end }}
{{ if (isset .Site.Params.social "facebook") and (isset (.Site.Params.social "twitter" or .Site.Params.social "instagram" or .Site.Params.social "youtube" or .Site.Params.social "community")) }}
{{ if (.Site.Params.social.facebook) and (.Site.Params.social.twitter or .Site.Params.social.instagram or .Site.Params.social.youtube or .Site.Params.social.community) }}
&nbsp;
{{ end }}
{{ with .Site.Params.social.twitter }}
......@@ -11,7 +11,7 @@
<i class="fa fa-twitter" alt="Follow @{{ . }} on Twitter" title="Follow @um_fencing on Twitter" aria-hidden="true"></i>
</a>
{{ end }}
{{ if (isset .Site.Params.social "twitter") and (isset (.Site.Params.social "instagram" or .Site.Params.social "youtube" or .Site.Params.social "community")) }}
{{ if ( .Site.Params.social.twitter) and (.Site.Params.social.instagram or .Site.Params.social.youtube or .Site.Params.social.community) }}
&nbsp;
{{ end }}
{{ with .Site.Params.social.instagram }}
......@@ -19,7 +19,7 @@
<i class="fa fa-instagram" alt="See our latest pictures on Instagram at @{{ . }}" title="See our latest pictures on Instagram at @{{ . }}" aria-hidden="true"></i>
</a>
{{ end }}
{{ if (isset .Site.Params.social "instagram") and (isset (.Site.Params.social "youtube" or .Site.Params.social "community")) }}
{{ if ( .Site.Params.social.instagram) and (.Site.Params.social.youtube or .Site.Params.social.community) }}
&nbsp;
{{ end }}
{{ with .Site.Params.social.youtube }}
......@@ -27,7 +27,7 @@
<i class="fa fa-youtube" alt="Watch bouts and more on YouTube" title="Watch bouts and more on YouTube" aria-hidden="true"></i>
</a>
{{ end }}
{{ if (isset .Site.Params.social "youtube") and (isset (.Site.Params.social "community")) }}
{{ if ( .Site.Params.social.youtube) and (.Site.Params.social.community) }}
&nbsp;
{{ end }}
{{ with .Site.Params.social.community }}
......
{{ $isHomePage := eq .Title .Site.Title }}
{{ $baseUrl := .Site.BaseURL }}
{{ if isset .Site.Params "sponsor" }}
{{ if .Site.Params.sponsor }}
<p>
{{ with .Site.Params.sponsor.link }}
<a href='{{ . }}' target='_blank'>
{{ end }}
{{ if isset .Site.Params.sponsor "logo" }}
<img src='{{ if $isHomePage }}{{ .Site.Params.sponsor.logo }}{{ else }}{{ $baseUrl }}/{{ .Site.Params.sponsor.logo }}{{ end }}' style='width: {{ with .Site.Params.sponsor.size }}{{ . }}{{ else }}100px{{ end }};' title='{{ with .Site.Params.sponsor.text }}{{ . }}{{ else }}Sponsor logo{{ end }}' alt='{{ with .Site.Params.sponsor.text }}{{ . }}{{ else }}Sponsor logo{{ end }}'>
{{ if .Site.Params.sponsor.logo }}
<img src='{{ $baseUrl }}/{{ .Site.Params.sponsor.logo }}' style='width: {{ with .Site.Params.sponsor.size }}{{ . }}{{ else }}100px{{ end }};' title='{{ with .Site.Params.sponsor.text }}{{ . }}{{ else }}Sponsor logo{{ end }}' alt='{{ with .Site.Params.sponsor.text }}{{ . }}{{ else }}Sponsor logo{{ end }}'>
{{ else }}
{{ with .Site.Params.sponsor.text }}{{ . }}{{ end }}
{{ end }}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment