Commit bb4de7a3 authored by Kaushal Modi's avatar Kaushal Modi

Use the global variables site and hugo introduced in Hugo 0.53

So now no need to think if .Site needs to be used vs $.Site. Yay!
parent c33a0a9e
......@@ -38,23 +38,23 @@ This theme can be tweaked using the following =[Params]= variables in
:PROPERTIES:
:CUSTOM_ID: isso-comment-support
:END:
To enable the Isso comment block, the =.Site.Params.isso= block needs to be
To enable the Isso comment block, the =site.Params.isso= block needs to be
present.
- =.Site.Params.isso.server= -- This is a mandatory variable. It must match the
- =site.Params.isso.server= -- This is a mandatory variable. It must match the
=[server] > listen= variable set in the =isso.conf= file (See [[https://posativ.org/isso/docs/configuration/server/][Isso Server
Configuration]]).
- =.Site.Params.isso.hidenamefield= -- Presence of this variable will hide the
- =site.Params.isso.hidenamefield= -- Presence of this variable will hide the
Name field.
- =.Site.Params.isso.hideemailfield= -- Presence of this variable will hide the
- =site.Params.isso.hideemailfield= -- Presence of this variable will hide the
Email field.
- =.Site.Params.isso.hidewebsitefield= -- Presence of this variable will hide the
- =site.Params.isso.hidewebsitefield= -- Presence of this variable will hide the
Website field.
- =.Site.Params.isso.tagline= -- This is an HTML string which is appended at the
- =site.Params.isso.tagline= -- This is an HTML string which is appended at the
end of the Isso comment thread. Below example gives an idea of how this can be
used.
#+begin_example
[Params]
[Params.isso] # Presence of .Site.Params.isso will enable Isso comments
[Params.isso] # Presence of site.Params.isso will enable Isso comments
server = "localhost:1234" # Mandatory variable
# hidenamefield = true # uncomment this line to hide the Name field
# hideemailfield = true # uncomment this line to hide the Email field
......
......@@ -13,7 +13,7 @@
var s = d.createElement('script');
s.type = 'text/javascript';
s.async = true;
// This code is within the scope of .Site.DisqusShortname, so below {{ . }} is all that's needed.
// This code is within the scope of site.DisqusShortname, so below {{ . }} is all that's needed.
s.src = '//{{ . }}.disqus.com/embed.js';
/* s.setAttribute('data-timestamp', +new Date());*/
......
{{ $icons_map := .Site.Data.taxonomy.icons }}
{{ $icons_map := site.Data.taxonomy.icons }}
<div class="post-taxo right no-color-links">
{{ range $taxo, $icon := $icons_map }}
{{ with $.Page.Param $taxo }}
......@@ -9,7 +9,7 @@
&nbsp;
<i class="{{ $.Param "fontawesome.style" | default "fal" }} {{ $icon }}"></i>&nbsp;&nbsp;
{{ range $cnt, $taxo_term := $taxo_list }}
{{ with $.Site.GetPage (printf "/%s/%s" $taxo ($taxo_term | urlize)) }}
{{ with site.GetPage (printf "/%s/%s" $taxo ($taxo_term | urlize)) }}
<a class="p-category" href="{{ .Permalink }}">{{ $taxo_term }}</a>
{{ end }}
{{ if lt $cnt (sub $count 1) }}
......
......@@ -2,14 +2,14 @@
:PROPERTIES:
:CUSTOM_ID: remarkbox-comment-support
:END:
To enable the Remarkbox comment block, the =.Site.Params.remarkbox= block needs
To enable the Remarkbox comment block, the =site.Params.remarkbox= block needs
to be present.
- =.Site.Params.remarkbox.owner_key= -- This is a mandatory variable. Enter your
- =site.Params.remarkbox.owner_key= -- This is a mandatory variable. Enter your
Remarkbox =rb_owner_key= value here.
#+begin_example
[Params]
[Params.remarkbox] # Presence of .Site.Params.remarkbox will enable Remarkbox comments
[Params.remarkbox] # Presence of site.Params.remarkbox will enable Remarkbox comments
owner_key = "fmcwgrsa-qlym-gces-bkkv-srvpfjsutwhg" # random keys used here for example
#+end_example
*** Useful CSS for the Remarkbox iframe
......
{{ with .Site.Params.remarkbox }}
{{ with site.Params.remarkbox }}
<div class="comments clear-float">
<hr />
<h2>Comments</h2>
{{ partial "remarkbox.html" . }}
</div>
{{ else }}
{{ with .Site.Params.isso }}
{{ with site.Params.isso }}
<div class="comments clear-float">
<hr />
<h2>Comments</h2>
{{ partial "isso.html" . }}
</div>
{{/* else if not (eq .Site.DisqusShortname "") */}}
{{/* else if not (eq site.DisqusShortname "") */}}
<!-- Below works the same way as the above empty-string equality check -->
{{ else }}
{{ with .Site.DisqusShortname }}
{{ with site.DisqusShortname }}
<div class="comments clear-float">
{{ partial "disqus.html" . }}
</div>
......
theme = ["hugo-debugprint", "hugo-atom-feed", "hugo-jf2", "hugo-search-fuse-js", "refined"]
# Default values of custom .Site.Params
# Default values of custom site.Params
[Params]
# https://github.com/tummychow/lanyon-hugo/issues/2#issuecomment-253274278
# Go date formats: https://golang.org/pkg/time/#pkg-constants
......
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"{{ with .Site.LanguageCode }} xml:lang="{{ . }}" lang="{{ . }}"{{ end }}>
<html xmlns="http://www.w3.org/1999/xhtml"{{ with site.LanguageCode }} xml:lang="{{ . }}" lang="{{ . }}"{{ end }}>
{{ partial "head.html" . }}
......@@ -13,10 +13,10 @@
<div class="container">
<header class="masthead">
<div class="masthead-title no-text-decoration">
<a href="/">{{ .Site.Title }}</a> <span class="blinking-cursor"></span>
<a href="/">{{ site.Title }}</a> <span class="blinking-cursor"></span>
</div>
<div class="masthead-tagline">
{{ .Site.Params.tagline }}
{{ site.Params.tagline }}
</div>
</header>
......
......@@ -12,21 +12,21 @@
"My site title"
*/}}
{{- with .Title -}}
{{- if (not (eq . $.Site.Title)) }}
{{- if (not (eq . site.Title)) }}
{{ . }} on
{{ end }}
{{ end }}
{{ .Site.Title -}}
{{ site.Title -}}
</title>
<link>{{ .Permalink }}</link>
<description>Recent content {{ with .Title }}{{ if (not (eq . $.Site.Title)) }} in {{ . }}{{ end }}{{ end }}
on {{ .Site.Title }}</description>
{{ with .Site.LanguageCode }}<language>{{ . }}</language>{{ end }}
{{ with .Site.Copyright }}<copyright>{{ . }}</copyright>{{end}}
{{- with .Site.Author.name -}}
{{ if $.Site.Author.email }}
<managingEditor>{{ printf "%s (%s)" $.Site.Author.email . }}</managingEditor>
<webMaster>{{ printf "%s (%s)" $.Site.Author.email . }}</webMaster>
<description>Recent content {{ with .Title }}{{ if (not (eq . site.Title)) }} in {{ . }}{{ end }}{{ end }}
on {{ site.Title }}</description>
{{ with site.LanguageCode }}<language>{{ . }}</language>{{ end }}
{{ with site.Copyright }}<copyright>{{ . }}</copyright>{{end}}
{{- with site.Author.name -}}
{{ if site.Author.email }}
<managingEditor>{{ printf "%s (%s)" site.Author.email . }}</managingEditor>
<webMaster>{{ printf "%s (%s)" site.Author.email . }}</webMaster>
{{- else -}}
<managingEditor>{{ . }}</managingEditor>
<webMaster>{{ . }}</webMaster>
......@@ -38,7 +38,7 @@
{{- with .OutputFormats.Get "RSS" -}} <!-- Here, the Get is case-insensitive. -->
<atom:link href="{{ .Permalink }}" rel="self" type="{{ .MediaType.Type }}" />
{{- end -}}
{{ range first 15 (where .Pages "Type" "in" .Site.Params.mainSections) }}
{{ range first 15 (where .Pages "Type" "in" site.Params.mainSections) }}
{{ $page := . }}
<item>
<title>{{ .Title }}</title>
......@@ -51,11 +51,11 @@
<author>{{ printf "%[email protected] (%s)" (. | replaceRE " " ".") . }}</author>
{{- end -}}
{{- end }}
{{ with .Site.Taxonomies }}
{{ with site.Taxonomies }}
{{ range $taxo,$_ := . }} <!-- Defaults taxos: "tags", "categories" -->
{{ with $page.Param $taxo }}
{{ $taxo_list := . }} <!-- $taxo_list will be the tags/categories list -->
{{ with $.Site.GetPage (printf "/%s" $taxo) }}
{{ with site.GetPage (printf "/%s" $taxo) }}
{{ $taxonomy_page := . }}
{{ range $taxo_list }} <!-- Below, assuming pretty URLs -->
<category domain="{{ printf "%s%s" $taxonomy_page.Permalink (. | urlize) }}">{{ . }}</category>
......
......@@ -8,7 +8,7 @@
<ul>
{{ range .Data.Terms.ByCount }}
{{ $count := .Count }}
{{ with $.Site.GetPage (printf "/%s/%s" $type (.Name | urlize)) }} <!-- .Name in OrderedTaxonomyEntry object -->
{{ with site.GetPage (printf "/%s/%s" $type (.Name | urlize)) }} <!-- .Name in OrderedTaxonomyEntry object -->
<li>
<a href="{{ .Permalink }}">{{ .Name }}</a> ({{ $count }}) <!-- .Name in Page -->
</li>
......
......@@ -45,11 +45,11 @@
{{ $term_count := (len .Pages) }}
{{ if $has_some_content }}
{{ $phrase := (index .Site.Data.taxonomy.phrases .Data.Plural) | replaceRE "%T" (printf "‘%s’" $term) | replaceRE "%N" "this" }}
{{ $phrase := (index site.Data.taxonomy.phrases .Data.Plural) | replaceRE "%T" (printf "‘%s’" $term) | replaceRE "%N" "this" }}
<h2 class="p-name">{{ printf "Posts %s (%d)" $phrase $term_count }}</h2>
{{ else }}
<div class="center">{{ partial "taxo-buttons.html" . }}</div>
{{ $phrase := (index .Site.Data.taxonomy.phrases .Data.Plural) | replaceRE "%T" (printf "‘%s’" $term) | replaceRE "%N" (printf "‘%s’" .Name) }}
{{ $phrase := (index site.Data.taxonomy.phrases .Data.Plural) | replaceRE "%T" (printf "‘%s’" $term) | replaceRE "%N" (printf "‘%s’" .Name) }}
<h1 class="p-name">{{ printf "Posts %s (%d)" $phrase $term_count }}</h1>
{{ end }}
</header>
......
......@@ -13,7 +13,7 @@
{{ $count := .Count }}
{{ $count_div_5 := (div .Count 5) }} <!-- intentionally getting truncated value -->
{{ $term := .Term }}
{{ with $.Site.GetPage (printf "/%s/%s" $type $term) }}
{{ with site.GetPage (printf "/%s/%s" $type $term) }}
<!-- Provision put in for up to 5*(19+1) = 100 posts for any tag/cateogry. -->
<li class="{{ printf "x%02d" (cond (gt $count_div_5 19) 19 $count_div_5) }}"
title="{{ printf "%d post%s with %s ‘%s’" $count (cond (gt $count 1) "s" "") $singular $term }}">
......
......@@ -8,7 +8,7 @@
<data class="p-name" value="{{ .Title }}"></data>
</header>
<!-- http://justindunham.net/blog-bells-and-whistles-in-hugo/ -->
{{ range where (.Paginator 10).Pages "Type" "in" .Site.Params.mainSections }}
{{ range where (.Paginator 10).Pages "Type" "in" site.Params.mainSections }}
{{ .Render "summary"}} <!-- Use layouts/_default/summary.html -->
{{ end }}
</div>
......
{{/* partial "debugprint.html" . */}}
{{ $scratch_var := (printf "__first_%s_%s" .Kind .Type) }}
{{ with .Site.Taxonomies }}
{{ with site.Taxonomies }}
{{ $.Scratch.Set $scratch_var true }}
<div class="all-terms right no-text-decoration">
{{ range $taxo,$_ := . }}
......@@ -12,7 +12,7 @@
<!-- Do not print "all tags" link on a "tags" taxonomyTerm page, and same for other taxos. -->
{{ $allow_current_taxo__taxonomyTerm := (and (eq $.Page.Kind "taxonomyTerm") (ne $.Page.Type $taxo) (ne $taxo "series")) }}
{{ if (or $allow_current_taxo__taxonomy $allow_current_taxo__taxonomyTerm) }}
{{ with $.Site.GetPage (printf "/%s" $taxo) }}
{{ with site.GetPage (printf "/%s" $taxo) }}
{{ $pipe_maybe := (cond ($.Scratch.Get $scratch_var) "" " | ") }}
{{ printf `<span class="%s">%s<a href="%s">all <span class="term">%s</span></a></span>` $taxo $pipe_maybe .Permalink $taxo | safeHTML }}
{{ $.Scratch.Set $scratch_var false }}
......
<!-- https://gist.github.com/carlmjohnson/e3716a0a89fab0484d0552a750c8cfb7 -->
{{ range .Site.Params.custom_css }}
{{ range site.Params.custom_css }}
{{ $asset := . }}
{{ if $.Site.Params.css_lazy_load }} <!-- If CSS lazy loading is enabled -->
{{ if $.Site.Params.cache_busting }}
{{ if in (string .Site.BaseURL) "localhost" }}
{{ if site.Params.css_lazy_load }} <!-- If CSS lazy loading is enabled -->
{{ if site.Params.cache_busting }}
{{ if site.IsServer }}
<link href="{{ $asset | relURL }}" rel="preload" as="style" onload="this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="{{ $asset | relURL }}"></noscript>
{{ else }}
......@@ -16,8 +16,8 @@
<noscript><link rel="stylesheet" href="{{ $asset | relURL }}"></noscript>
{{ end }}
{{ else }} <!-- If CSS lazy loading is disabled (default) -->
{{ if $.Site.Params.cache_busting }}
{{ if in (string $.Site.BaseURL) "localhost" }}
{{ if site.Params.cache_busting }}
{{ if site.IsServer }}
<link rel="stylesheet" href="{{ $asset | relURL }}">
{{ else }}
{{ $asset_min_cache_busted := resources.Get $asset | minify | fingerprint }}
......
{{ $author := (slice) }} <!-- Set the $author to be an empty slice by default -->
{{ $site := .page.Site }}
{{ with $site.Author.name }}
{{ with site.Author.name }}
{{ $author = (slice .) }} <!-- Set the default to site author, if specified -->
{{ end }}
<!-- Override $author value with that present in page front-matter -->
......@@ -17,7 +16,7 @@
{{ if (eq "u-author" $.fmt) }}
<!-- Link the u-author link inside h-entry with the u-url in the external h-card -->
<span class="hide">
&mdash; <a href="{{ $site.BaseURL }}" class="u-author">{{ . }}</a>
&mdash; <a href="{{ site.BaseURL }}" class="u-author">{{ . }}</a>
</span>
{{ else if (eq "DC" $.fmt) }} <!-- Dublin Core metadata DC.Creator -->
<!-- http://www.dublincore.org/documents/2000/07/16/usageguide/simple-html/ -->
......
{{ $badge_width := 80 }}
{{ $badge_height := 15 }}
{{ $permalink := .Permalink }}
{{ $site := .Site }}
<div class="badges no-text-decoration">
<!-- Indieweb badges -->
{{ with .Site.Params.indieweb }}
{{ with site.Params.indieweb }}
<a href="https://indieweb.org/">
{{ $img := resources.Get "images/indieweb-badge--optimized.png" | fingerprint }}
<img src="{{ $img.RelPermalink }}"
......@@ -46,7 +45,7 @@
{{ end }}
{{ end }}
{{ with .Site.Params.html5_validator }}
{{ with site.Params.html5_validator }}
<!-- HTML5 badge -->
{{ $html5_validator_link := printf "https://html5.validator.nu/?doc=%s&showsource=yes" $permalink }}
<a href="{{ $html5_validator_link }}">
......
{{ with .Site.Params.isso }}
{{ with site.Params.isso }}
<div class="comments clear-float">
<hr />
<h2>Comments</h2>
......
......@@ -4,7 +4,7 @@
Save the resultant file as data/disqus_comments.json.
-->
{{ $page := . }}
{{ with .Site.Data.disqus_comments.disqus }}
{{ with site.Data.disqus_comments.disqus }}
{{ $threads := (index . "thread") }}
{{ $comments := (index . "post") }}
{{ range $threads }}
......
{{ $page_params := .Params }}
{{ $site_params := .Site.Params }}
{{ partialCached "social.html" . }}
{{ $ox_hugo_string := "" }}
{{ $source_string := "" }}
{{ $file_info := .File }}
{{ with $site_params.source }}
{{ with site.Params.source }}
{{ $source := . }}
{{ $branch := $source.branch | default "master" }}
{{ with (or $source.org_dir $source.md_dir) }}
......@@ -14,9 +13,9 @@
{{ end }}
{{ with $source.ox_hugo }}
{{ with $page_params.creator }}
{{ $ox_hugo_string = . | replaceRE "ox-hugo" (printf `<a href="%s"><code>ox-hugo</code></a>` $site_params.urls.ox_hugo) }}
{{ $ox_hugo_string = . | replaceRE "ox-hugo" (printf `<a href="%s"><code>ox-hugo</code></a>` site.Params.urls.ox_hugo) }}
{{ else }}
{{ $ox_hugo_string = printf `the <a href="%s"><code class="nobr">ox-hugo</code></a> package for Emacs/Org-mode` $site_params.urls.ox_hugo }}
{{ $ox_hugo_string = printf `the <a href="%s"><code class="nobr">ox-hugo</code></a> package for Emacs/Org-mode` site.Params.urls.ox_hugo }}
{{ end }}
{{ $ox_hugo_string = printf "%s +" $ox_hugo_string }}
{{ end }}
......@@ -36,13 +35,12 @@
{{ end }}
{{ end }}
{{ $refined_theme_string := printf `<a href="%s"><code class="nobr">hugo-theme-refined</code></a>` $site_params.urls.refined }}
{{ $refined_theme_string := printf `<a href="%s"><code class="nobr">hugo-theme-refined</code></a>` site.Params.urls.refined }}
{{ $hugo_version := .Hugo.Version }}
{{ $hugo_version_string_1 := printf `<span class="nobr">Hugo %s</span>` $hugo_version }}
{{ with .Hugo.CommitHash }} <!-- Example value: "975bb629:chroma-d5ca12b" -->
{{ $hugo_version_string_1 := hugo.Version }}
{{ with hugo.CommitHash }} <!-- Example value: "975bb629:chroma-d5ca12b" -->
{{ $hugo_commit_string := . | replaceRE "^([0-9a-f]{7,}).*" "${1}" }}
{{ $hugo_version_string_1 = printf `<a href="%s/commit/%s">%s</a>` $site_params.urls.hugo $hugo_commit_string $hugo_version }}
{{ $hugo_version_string_1 = printf `<a href="%s/commit/%s">%s</a>` site.Params.urls.hugo $hugo_commit_string $hugo_version_string_1 }}
{{ end }}
{{ $hugo_version_string := printf `<span class="nobr">Hugo %s</span>` $hugo_version_string_1 }}
......@@ -51,7 +49,7 @@
</p>
<p>
{{ with $site_params.footer }}
{{ with site.Params.footer }}
{{ . | safeHTML }}
{{ end }}
</p>
......
{{ with .Site.GoogleAnalytics }}
{{ with site.GoogleAnalytics }}
{{ "<!-- Google Analytics -->" | safeHTML }}
<script type="application/javascript">
// https://stackoverflow.com/a/41065130/1219634
......
......@@ -3,19 +3,18 @@
<!-- https://indiewebify.me/validate-h-card/ -->
<!-- h-entry validation: https://xray.p3k.io/ -->
<!-- authorship testing: https://sturdy-backbone.glitch.me/ -->
{{ $site := .Site }}
{{ with .Site.Author }}
{{ with site.Author }}
<div class="h-card">
{{ with .photo }}
{{ $img := resources.Get .url | fingerprint }}
<img class="u-photo"
{{- with $.Site.Author.name }} alt="Photo of {{ . }}"{{ end }}
{{- with site.Author.name }} alt="Photo of {{ . }}"{{ end }}
src="{{ $img.RelPermalink }}"
{{- with .width }} width="{{ . }}"{{ end -}}
{{- with .height }} height="{{ . }}"{{ end -}}>
{{ end }}
<!-- Below u-url link must match with the u-author link in h-entry blocks to link this h-card with them. -->
<a class="p-name u-url" href="{{ $.Site.BaseURL }}">{{ with .name }}{{ . }}{{ end }}</a>
<a class="p-name u-url" href="{{ site.BaseURL }}">{{ with .name }}{{ . }}{{ end }}</a>
{{ with .email }}
<p>
{{ printf `<a class="u-email" href="mailto:%s" rel="me">%s</a>` . . | safeHTML }}
......
......@@ -13,9 +13,9 @@
<title>
{{ if eq .URL "/" }}
{{ .Site.Title }} ❚
{{ site.Title }} ❚
{{ else }}
{{ .Title }} ❚ {{ .Site.Title }}
{{ .Title }} ❚ {{ site.Title }}
{{ end }}
</title>
......@@ -25,7 +25,7 @@
<!-- Lazy load CSS -->
<!-- https://github.com/filamentgroup/loadCSS -->
<!-- view-source:https://master-origin-loadcss.fgview.com/test/preload.html -->
{{ with .Site.Params.css_lazy_load }}
{{ with site.Params.css_lazy_load }}
<script type="application/javascript">
/*! loadCSS. [c]2017 Filament Group, Inc. MIT License */
!function(a){"use strict";var b=function(b,c,d){function e(a){return h.body?a():void setTimeout(function(){e(a)})}function f(){i.addEventListener&&i.removeEventListener("load",f),i.media=d||"all"}var g,h=a.document,i=h.createElement("link");if(c)g=c;else{var j=(h.body||h.getElementsByTagName("head")[0]).childNodes;g=j[j.length-1]}var k=h.styleSheets;i.rel="stylesheet",i.href=b,i.media="only x",e(function(){g.parentNode.insertBefore(i,c?g:g.nextSibling)});var l=function(a){for(var b=i.href,c=k.length;c--;)if(k[c].href===b)return a();setTimeout(function(){l(a)})};return i.addEventListener&&i.addEventListener("load",f),i.onloadcssdefined=l,l(f),i};"undefined"!=typeof exports?exports.loadCSS=b:a.loadCSS=b}("undefined"!=typeof global?global:this);
......@@ -59,7 +59,7 @@
Then lazy loading the whole refined.css is fine.
Do so fixing the clipping issue of the navbar. -->
<style>
{{ $theme := index .Site.Data.theme (.Param "themecolorbase") }}
{{ $theme := index site.Data.theme (.Param "themecolorbase") }}
{{ with $theme }}
:root {
--theme-color: {{ index . "default_color" | safeCSS }};
......@@ -112,7 +112,7 @@
<!-- Isso -->
<!-- https://github.com/posativ/isso/issues/287 -->
{{ with .Site.Params.isso }}
{{ with site.Params.isso }}
<style>
{{ with .hidenamefield }} #isso-thread input[name="author"] {display: none;} {{ end }}
{{ with .hideemailfield }} #isso-thread input[name="email"] {display: none;} {{ end }}
......@@ -155,7 +155,7 @@
<!-- RSS -->
<!-- https://gohugo.io/templates/rss/#reference-your-rss-feed-in-head -->
{{ range .AlternativeOutputFormats -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink (printf "%s for %s" (.Name | title) $.Site.Title) | safeHTML }}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink (printf "%s for %s" (.Name | title) site.Title) | safeHTML }}
{{ end -}}
<!-- Author -->
......@@ -164,7 +164,7 @@
<!-- Hugo info -->
<!-- https://stackoverflow.com/a/10534167/1219634 -->
<!-- https://w3c.github.io/html/single-page.html#the-meta-element -->
{{ printf `<meta name="hugo-build-date" content="%s"/>` .Hugo.BuildDate | safeHTML }}
{{ printf `<meta name="hugo-commit-hash" content="%s"/>` .Hugo.CommitHash | safeHTML }}
{{ .Hugo.Generator }}
{{ printf `<meta name="hugo-build-date" content="%s"/>` hugo.BuildDate | safeHTML }}
{{ printf `<meta name="hugo-commit-hash" content="%s"/>` hugo.CommitHash | safeHTML }}
{{ hugo.Generator }}
</head>
<!-- https://indieauth.com/setup -->
{{ printf `<!-- rel="me" links for IndieAuth -->` | safeHTML }}
{{ $relme_exists := false }}
{{ range $.Site.Params.social -}}
{{ range site.Params.social -}}
{{- if .relme -}}
{{- printf `<link href="%s" rel="me">` .link | safeHTML -}}
{{ $relme_exists = true }}
......@@ -17,7 +17,7 @@
<link rel="token_endpoint" href="https://tokens.indieauth.com/token">
{{ end }}
{{ with .Site.Params.indieweb }}
{{ with site.Params.indieweb }}
{{ $domain := .domain }}
{{ with .webmention }}
{{ printf `<link rel="pingback" href="%s%s/xmlrpc" />` .endpoint .account | safeHTML }}
......
<!-- This code is within the scope of $.Site.Params.isso -->
<!-- This code is within the scope of site.Params.isso -->
<script data-isso="//{{ .server }}/"
src="//{{ .server }}/js/embed.min.js">
</script>
......
......@@ -2,12 +2,12 @@
<nav id="nav" class="nav-collapse opened" aria-hidden="false">
<ul class="navbar">
<li><a class="{{ if eq .Kind "home" }}active{{ end }}" href="/">Home</a></li>
{{ range $.Site.Params.mainSections }}
{{ with $.Site.GetPage (printf "/%s" .) }}
{{ range site.Params.mainSections }}
{{ with site.GetPage (printf "/%s" .) }}
<li><a class="{{ if eq $page_relpermalink .RelPermalink }}active{{ end }}" href="{{ .Permalink }}">{{ .Type | title }}</a></li>
{{ end }}
{{ end }}
{{ with .Site.GetPage "/search" }}
{{ with site.GetPage "/search" }}
<li><a class="{{ if eq $page_relpermalink .RelPermalink }}active{{ end }}" href="{{ .Permalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>
......
......@@ -2,7 +2,7 @@
{{ $permalink_pretty := .Permalink | replaceRE "\\.html$" "/" }} <!-- Always have a trailing slash, even with uglyURLs enabled. -->
<meta property="og:title" content="{{ .Title }}" />
<meta property="og:description"
content="{{ with .Description }}{{ . | markdownify | plainify }}{{ else }}{{ if .IsPage }}{{ partial "summary_minus_toc.html" . | markdownify | plainify }}{{ else }}{{ with .Site.Params.description }}{{ . | markdownify | plainify }}{{ end }}{{ end }}{{ end }}" />
content="{{ with .Description }}{{ . | markdownify | plainify }}{{ else }}{{ if .IsPage }}{{ partial "summary_minus_toc.html" . | markdownify | plainify }}{{ else }}{{ with site.Params.description }}{{ . | markdownify | plainify }}{{ end }}{{ end }}{{ end }}" />
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
<meta property="og:url" content="{{ .Permalink }}" />
{{ with .Params.images }}
......@@ -11,7 +11,7 @@
<!-- Cannot use absURL below because it doesn't work as expected if baseURL has a subdir.
See https://hugo-sandbox.netlify.com/subdir-canonify-true/ .
-->
{{ $baseurl_no_trailing_slash := $.Site.BaseURL | replaceRE "/$" "" }}
{{ $baseurl_no_trailing_slash := site.BaseURL | replaceRE "/$" "" }}
<meta name="og:image" content="{{ (printf "%s%s" $baseurl_no_trailing_slash .) }}"/>
{{ else }}
<meta name="og:image" content="{{ (printf "%s%s" $permalink_pretty .) }}"/>
......@@ -34,7 +34,7 @@
{{ end }}
{{ with .Params.audio }}
{{ if (findRE "^/" .) }} <!-- If audio link has a leading slash -->
{{ $baseurl_no_trailing_slash := $.Site.BaseURL | replaceRE "/$" "" }}
{{ $baseurl_no_trailing_slash := site.BaseURL | replaceRE "/$" "" }}
<meta name="og:audio" content="{{ (printf "%s%s" $baseurl_no_trailing_slash .) }}"/>
{{ else }}
<meta name="og:audio" content="{{ (printf "%s%s" $permalink_pretty .) }}"/>
......@@ -43,13 +43,13 @@
{{ with .Params.locale }}
<meta property="og:locale" content="{{ . }}" />
{{ end }}
{{ with .Site.Params.title }}
{{ with site.Params.title }}
<meta property="og:site_name" content="{{ . }}" />
{{ end }}
{{ with .Params.videos }}
{{ range . }}
{{ if (findRE "^/" .) }} <!-- If video link has a leading slash -->
{{ $baseurl_no_trailing_slash := $.Site.BaseURL | replaceRE "/$" "" }}
{{ $baseurl_no_trailing_slash := site.BaseURL | replaceRE "/$" "" }}
<meta name="og:video" content="{{ (printf "%s%s" $baseurl_no_trailing_slash .) }}"/>
{{ else }}
<meta name="og:video" content="{{ (printf "%s%s" $permalink_pretty .) }}"/>
......@@ -57,11 +57,10 @@
{{ end }}
{{ end }}
<!-- If it is part of a series, link to related articles -->
{{ $siteSeries := .Site.Taxonomies.series }}
{{ if $siteSeries }}
{{ if site.Taxonomies.series }}
{{ with .Params.series }}
{{ range $name := . }}
{{ $series := index $siteSeries $name }}
{{ $series := index site.Taxonomies.series $name }}
{{ range $page := first 6 $series.Pages }}
{{ if ne $page.Permalink $permalink }}
<meta property="og:see_also" content="{{ $page.Permalink }}" />
......@@ -72,11 +71,11 @@
{{ end }}
{{ if .IsPage }}
{{ range .Site.Authors }}
{{ range site.Authors }}
{{ with .Social.facebook }}
<meta property="article:author" content="https://www.facebook.com/{{ . }}" />
{{ end }}
{{ with .Site.Social.facebook }}
{{ with site.Social.facebook }}
<meta property="article:publisher" content="https://www.facebook.com/{{ . }}" />
{{ end }}
<meta property="article:section" content="{{ .Section }}" />
......@@ -88,6 +87,6 @@
{{ end }}
{{ end }}
<!-- Facebook Page Admin ID for Domain Insights -->
{{ with .Site.Social.facebook_admin }}
{{ with site.Social.facebook_admin }}
<meta property="fb:admins" content="{{ . }}" />
{{ end }}
......@@ -15,17 +15,17 @@
{{ range .Params.series }}
{{ $series_name := . }}
{{ $series_name_urlized := (. | urlize) }}
{{ $series_page := ($.Site.GetPage (printf "/series/%s" $series_name_urlized)) }}
{{ $series_page := (site.GetPage (printf "/series/%s" $series_name_urlized)) }}
{{ $series_page_empty_content := (eq "" ($series_page.Content | replaceRE "[[:^alpha:]]" "")) }}
<!--
$.Site.Taxonomies.series then is a map with key = "urlized value
site.Taxonomies.series then is a map with key = "urlized value
of the series name", and value = WeightedPages object. The
WeightedPages object holds a list of WeightedPage objects.
-->
{{ with $.Site.Taxonomies.series }}
{{ with site.Taxonomies.series }}
{{ $weighted_pages := index . $series_name_urlized }}
<!-- It does not make sense to show the "series block" if that series has just one post. -->
{{ if (or (ge $weighted_pages.Count 2) $.Site.Data.series.todo) }}
{{ if (or (ge $weighted_pages.Count 2) site.Data.series.todo) }}
<div class="series">
<p>
<a href="#" id="series"></a>
......@@ -49,7 +49,7 @@
<tr><td class="date">{{ $date }}</td><td><a href="{{ .Permalink }}">{{ .Title }}</a></td></tr>
{{ end }}
{{ end }} <!-- ends range -->
{{ with $.Site.Data.series }}
{{ with site.Data.series }}
{{ with (index . $series_name) }}
{{ range (index . "todo") }}
<tr><td><span class="todo">TODO</span></td><td>{{ . }}</td></tr>
......@@ -60,5 +60,5 @@
</div>
<br />
{{ end }} <!-- ends if count -->
{{ end }} <!-- ends with $.Site.Taxonomies.series -->
{{ end }} <!-- ends with site.Taxonomies.series -->
{{ end }} <!-- ends with -->
......@@ -6,10 +6,10 @@
[[Params.social]]
name = "Mastodon"
link = "https://mastodon.technology/@kaushalmodi"
svg = "mastodon" # map key in .Site.Data.svg, other value: mastodon-alt
svg = "mastodon" # map key in site.Data.svg, other value: mastodon-alt
-->
{{ with .svg }}
{{ with (index $.Site.Data.svg . ) }}
{{ with (index site.Data.svg . ) }}
{{ . | safeHTML }}
{{ end }}
{{ else }}
......
{{ with .Site.Taxonomies }}
{{ with site.Taxonomies }}
<div class="taxo no-text-decoration">
{{ range $taxo,$_ := . }} <!-- Defaults taxos: "tags", "categories" -->
{{ with $.Page.Param $taxo }}
......@@ -6,7 +6,7 @@
{{ range . }}
{{ $term := . }}
{{ $term_urlized := (. | urlize) }}
{{ with $.Site.GetPage (printf "/%s/%s" $taxo $term_urlized) }}
{{ with site.GetPage (printf "/%s/%s" $taxo $term_urlized) }}
<!-- Each "taxonomy" Kind page has .Data.FOO element.
That FOO is the singular form of the taxo,
like "tag" or "category".
......@@ -24,7 +24,7 @@
{{ $term_count := (len (index .Data .Data.Singular)) }}
<!-- The "__<taxo>__" are special classes used to search/replace in taxonomy.html. -->
<li class="{{ printf "__%s__" $term_urlized }}"
{{ $phrase := (index $.Site.Data.taxonomy.phrases .Data.Plural) | replaceRE "%T" (printf "‘%s’" $term) | replaceRE "%N" (printf "‘%s’" .Name) }}
{{ $phrase := (index site.Data.taxonomy.phrases .Data.Plural) | replaceRE "%T" (printf "‘%s’" $term) | replaceRE "%N" (printf "‘%s’" .Name) }}
{{ if (eq 1 $term_count) }}
title="{{ printf "This is the only post %s" $phrase }}"
{{ else }}
......
......@@ -8,7 +8,7 @@
<!-- Cannot use absURL below because it doesn't work as expected if baseURL has a subdir.
See https://hugo-sandbox.netlify.com/subdir-canonify-true/ .
-->
{{ $baseurl_no_trailing_slash := $.Site.BaseURL | replaceRE "/$" "" }}