diff options
author | Phil Smith <phil@philhsmith.com> | 2019-12-19 10:32:29 +0300 |
---|---|---|
committer | Phil Smith <phil@philhsmith.com> | 2019-12-19 10:32:29 +0300 |
commit | e5064066c133a8e302baa116960e125f9cace43e (patch) | |
tree | 409c26b87fa7703c8a6c6bb593735db5ce171e1a | |
parent | 030af1c561e1f43915c57001f7f4f963078c153e (diff) |
Use $.Param instead of .Site.Params
This allows params to be set in either site config or page front matter.
-rwxr-xr-x | layouts/_default/single.html | 2 | ||||
-rwxr-xr-x | layouts/partials/footer.html | 10 | ||||
-rw-r--r-- | layouts/partials/head.html | 12 | ||||
-rwxr-xr-x | layouts/partials/header.html | 2 | ||||
-rwxr-xr-x | layouts/partials/link.html | 36 | ||||
-rw-r--r-- | layouts/partials/siteinfo.html | 12 |
6 files changed, 37 insertions, 37 deletions
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index a597d5d..9bc09f5 100755 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -22,7 +22,7 @@ {{ .Content }} </section> <footer> - {{ with .Site.Params.disqus }} + {{ with ($.Param "disqus") }} <div id="disqus_thread"></div> <script> var disqus_shortname = '{{ . }}'; diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index dd717a6..e4efdc0 100755 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -7,11 +7,11 @@ {{ with .Site.Copyright | safeHTML }} {{ . }} {{ else }} - {{ if .Site.Params.author }} - {{ if .Site.Params.authorwebsite }} - <a href="{{ .Site.Params.authorwebsite }}">{{ .Site.Params.author }}</a> + {{ if ($.Param "author") }} + {{ if ($.Param "authorwebsite") }} + <a href="{{ $.Param "authorwebsite" }}">{{ $.Param "author" }}</a> {{ else }} - {{ .Site.Params.author }} + {{ $.Param "author" }} {{ end }} {{ end }} • @@ -26,7 +26,7 @@ </footer> {{ if not .Site.IsServer }} - {{ with .Site.Params.ga_api_key }} + {{ with ($.Param "ga_api_key") }} <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 16e1b98..1bdc9db 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -7,13 +7,13 @@ <meta name="twitter:title" content="{{ . }}" /> {{ end }} - {{ with .Description | default .Site.Params.subtitle }} + {{ with .Description | default ($.Param "subtitle") }} <meta name="description" content="{{ . }}"> <meta property="og:description" content="{{ . }}"> <meta name="twitter:description" content="{{ . | truncate 200 }}"> {{ end }} - <meta name="author" content="{{ .Site.Params.author }}"/> + <meta name="author" content="{{ $.Param "author" }}"/> <meta property="og:site_name" content="{{ .Site.Title }}" /> <meta property="og:url" content="{{ .Permalink }}" /> @@ -23,14 +23,14 @@ {{ end }} <meta name="twitter:card" content="summary" /> - {{ with .Site.Params.twitter }} + {{ with ($.Param "twitter") }} <meta name="twitter:site" content="@{{ . }}" /> <meta name="twitter:creator" content="@{{ . }}" /> {{ end }} {{ if .IsPage }} <meta property="og:type" content="article" /> - {{ with .Site.Params.facebook }} + {{ with ($.Param "facebook") }} <meta property="og:article:author" content="https://facebook.com/{{ . }}" /> {{ end }} {{ else }} @@ -41,10 +41,10 @@ <link rel="stylesheet" href="{{ .Site.BaseURL }}css/style.css" /> <!-- Custom css files as define in config.toml --> - {{ range .Site.Params.custom_css -}} + {{ range ($.Param "custom_css") -}} <link rel="stylesheet" href="{{ . | absURL }}"> {{- end }} - {{- with .Site.Params.favicon }} + {{- with ($.Param "favicon") }} <link rel='icon' type='image/x-icon' href="{{ . | absURL }}" /> {{- end -}} {{ if eq .RelPermalink "/" }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 37c2867..0c79794 100755 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -10,7 +10,7 @@ {{ else }} <h1 class="c-title p-title"><a href="{{ .Site.BaseURL }}" class="p-title__link">{{ .Site.Title }}</a></h1> {{ end }} - {{ with .Site.Params.subtitle }} + {{ with ($.Param "subtitle") }} <p class="p-subtitle"> {{ . }} </p> diff --git a/layouts/partials/link.html b/layouts/partials/link.html index efa3511..a859471 100755 --- a/layouts/partials/link.html +++ b/layouts/partials/link.html @@ -1,6 +1,6 @@ -{{ if or ( .Site.Params.medium ) ( .Site.Params.twitter ) ( .Site.Params.facebook ) ( .Site.Params.instagram ) ( .Site.Params.googleplus ) ( .Site.Params.github ) ( .Site.Params.gitlab ) ( .Site.Params.npm ) ( .Site.Params.codepen ) ( .Site.Params.dribbble ) ( .Site.Params.fivehundredpx ) ( .Site.Params.flickr ) ( .Site.Params.pinterest ) ( .Site.Params.tumblr ) ( .Site.Params.vimeo ) ( .Site.Params.youtube ) ( .Site.Params.linkedin ) }} +{{ if or ( $.Param "medium" ) ( $.Param "twitter" ) ( $.Param "facebook" ) ( $.Param "instagram" ) ( $.Param "googleplus" ) ( $.Param "github" ) ( $.Param "gitlab" ) ( $.Param "npm" ) ( $.Param "codepen" ) ( $.Param "dribbble" ) ( $.Param "fivehundredpx" ) ( $.Param "flickr" ) ( $.Param "pinterest" ) ( $.Param "tumblr" ) ( $.Param "vimeo" ) ( $.Param "youtube" ) ( $.Param "linkedin" ) }} <ul class="c-links"> - {{ with .Site.Params.medium }} + {{ with ($.Param "medium") }} <li class="c-links__item"> <a href="https://medium.com/{{ . }}" target="_blank"> <svg viewBox="0 0 64 64" class="c-links__icon"> @@ -10,7 +10,7 @@ </a> </li> {{ end }} - {{ with .Site.Params.twitter }} + {{ with ($.Param "twitter") }} <li class="c-links__item"> <a href="https://twitter.com/{{ . }}" target="_blank"> <svg viewBox="0 0 64 64" class="c-links__icon"> @@ -20,7 +20,7 @@ </a> </li> {{ end }} - {{ with .Site.Params.facebook }} + {{ with ($.Param "facebook") }} <li class="c-links__item"> <a href="https://facebook.com/{{ . }}" target="_blank"> <svg viewBox="0 0 64 64" class="c-links__icon"> @@ -30,7 +30,7 @@ </a> </li> {{ end }} - {{ with .Site.Params.instagram }} + {{ with ($.Param "instagram") }} <li class="c-links__item"> <a href="https://instagram.com/{{ . }}" target="_blank"> <svg viewBox="0 0 64 64" class="c-links__icon"> @@ -40,7 +40,7 @@ </a> </li> {{ end }} - {{ with .Site.Params.googleplus }} + {{ with ($.Param "googleplus") }} <li class="c-links__item"> <a href="{{ . }}" target="_blank"> <svg viewBox="0 0 64 64" class="c-links__icon"> @@ -50,7 +50,7 @@ </a> </li> {{ end }} - {{ with .Site.Params.github }} + {{ with ($.Param "github") }} <li class="c-links__item"> <a href="https://github.com/{{ . }}" target="_blank"> <svg viewBox="0 0 64 64" class="c-links__icon"> @@ -60,7 +60,7 @@ </a> </li> {{ end }} - {{ with .Site.Params.gitlab }} + {{ with ($.Param "gitlab") }} <li class="c-links__item"> <a href="https://gitlab.com/{{ . }}" target="_blank"> <svg viewBox="0 0 64 64" class="c-links__icon"> @@ -70,7 +70,7 @@ </a> </li> {{ end }} - {{ with .Site.Params.npm }} + {{ with ($.Param "npm") }} <li class="c-links__item"> <a href="https://www.npmjs.com/{{ . }}" target="_blank"> <svg viewBox="0 0 64 64" class="c-links__icon"> @@ -80,7 +80,7 @@ </a> </li> {{ end }} - {{ with .Site.Params.codepen }} + {{ with ($.Param "codepen") }} <li class="c-links__item"> <a href="https://codepen.io/{{ . }}" target="_blank"> <svg viewBox="0 0 64 64" class="c-links__icon"> @@ -90,7 +90,7 @@ </a> </li> {{ end }} - {{ with .Site.Params.dribbble }} + {{ with ($.Param "dribbble") }} <li class="c-links__item"> <a href="https://dribbble.com/{{ . }}" target="_blank"> <svg viewBox="0 0 64 64" class="c-links__icon"> @@ -100,7 +100,7 @@ </a> </li> {{ end }} - {{ with .Site.Params.fivehundredpx }} + {{ with ($.Param "fivehundredpx") }} <li class="c-links__item"> <a href="https://500px.com/{{ . }}" target="_blank"> <svg viewBox="0 0 64 64" class="c-links__icon"> @@ -110,7 +110,7 @@ </a> </li> {{ end }} - {{ with .Site.Params.flickr }} + {{ with ($.Param "flickr") }} <li class="c-links__item"> <a href="https://www.flickr.com/photos/{{ . }}" target="_blank"> <svg viewBox="0 0 64 64" class="c-links__icon"> @@ -120,7 +120,7 @@ </a> </li> {{ end }} - {{ with .Site.Params.pinterest }} + {{ with ($.Param "pinterest") }} <li class="c-links__item"> <a href="https://www.pinterest.jp/{{ . }}" target="_blank"> <svg viewBox="0 0 64 64" class="c-links__icon"> @@ -130,7 +130,7 @@ </a> </li> {{ end }} - {{ with .Site.Params.tumblr }} + {{ with ($.Param "tumblr") }} <li class="c-links__item"> <a href="https://www.tumblr.com/blog/{{ . }}" target="_blank"> <svg viewBox="0 0 64 64" class="c-links__icon"> @@ -140,7 +140,7 @@ </a> </li> {{ end }} - {{ with .Site.Params.vimeo }} + {{ with ($.Param "vimeo") }} <li class="c-links__item"> <a href="https://vimeo.com/{{ . }}" target="_blank"> <svg viewBox="0 0 64 64" class="c-links__icon"> @@ -150,7 +150,7 @@ </a> </li> {{ end }} - {{ with .Site.Params.youtube }} + {{ with ($.Param "youtube") }} <li class="c-links__item"> <a href="https://www.youtube.com/user/{{ . }}" target="_blank"> <svg viewBox="0 0 64 64" class="c-links__icon"> @@ -160,7 +160,7 @@ </a> </li> {{ end }} - {{ with .Site.Params.linkedin }} + {{ with ($.Param "linkedin") }} <li class="c-links__item"> <a href="https://linkedin.com/in/{{ . }}" target="_blank"> <svg viewBox="0 0 64 64" class="c-links__icon"> diff --git a/layouts/partials/siteinfo.html b/layouts/partials/siteinfo.html index 05b9256..ddbe210 100644 --- a/layouts/partials/siteinfo.html +++ b/layouts/partials/siteinfo.html @@ -1,19 +1,19 @@ -{{ if or ( .Site.Params.avatar ) ( .Site.Params.author ) ( .Site.Params.bio ) ( .Site.Params.contact ) }} +{{ if or ( $.Param "avatar" ) ( $.Param "author" ) ( $.Param "bio" ) ( $.Param "contact" ) }} <aside class="p-author"> - {{ with .Site.Params.avatar }} + {{ with ($.Param "avatar") }} <div class="c-avatar p-author__avatar"> <img alt="Author Avatar" src="{{ . }}" /> </div> {{ end }} - {{ if or ( .Site.Params.author ) ( .Site.Params.bio ) ( .Site.Params.contact ) }} + {{ if or ( $.Param "author" ) ( $.Param "bio" ) ( $.Param "contact" ) }} <div class="p-author__body"> - {{ with .Site.Params.author }} + {{ with ($.Param "author") }} <p class="c-title p-author__name ">{{ . }}</p> {{ end }} - {{ with .Site.Params.bio }} + {{ with ($.Param "bio") }} <p>{{ . }}</p> {{ end }} - {{ with .Site.Params.contact }} + {{ with ($.Param "contact") }} <p> <a href="{{ . }}"> Contact me |