github.com/graemephi/kahugo@v0.62.3-0.20211121071557-d78c0423784d/tpl/tplimpl/embedded/templates.autogen.go (about) 1 // Copyright 2019 The Hugo Authors. All rights reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // http://www.apache.org/licenses/LICENSE-2.0 7 // 8 // Unless required by applicable law or agreed to in writing, software 9 // distributed under the License is distributed on an "AS IS" BASIS, 10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // See the License for the specific language governing permissions and 12 // limitations under the License. 13 14 // This file is autogenerated. 15 16 // Package embedded defines the internal templates that Hugo provides. 17 package embedded 18 19 // EmbeddedTemplates represents all embedded templates. 20 var EmbeddedTemplates = [][2]string{ 21 {`_default/robots.txt`, `User-agent: *`}, 22 {`_default/rss.xml`, `{{- $pctx := . -}} 23 {{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} 24 {{- $pages := slice -}} 25 {{- if or $.IsHome $.IsSection -}} 26 {{- $pages = $pctx.RegularPages -}} 27 {{- else -}} 28 {{- $pages = $pctx.Pages -}} 29 {{- end -}} 30 {{- $limit := .Site.Config.Services.RSS.Limit -}} 31 {{- if ge $limit 1 -}} 32 {{- $pages = $pages | first $limit -}} 33 {{- end -}} 34 {{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} 35 <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 36 <channel> 37 <title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title> 38 <link>{{ .Permalink }}</link> 39 <description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description> 40 <generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }} 41 <language>{{.}}</language>{{end}}{{ with .Site.Author.email }} 42 <managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }} 43 <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }} 44 <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }} 45 <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} 46 {{- with .OutputFormats.Get "RSS" -}} 47 {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} 48 {{- end -}} 49 {{ range $pages }} 50 <item> 51 <title>{{ .Title }}</title> 52 <link>{{ .Permalink }}</link> 53 <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> 54 {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}} 55 <guid>{{ .Permalink }}</guid> 56 <description>{{ .Summary | html }}</description> 57 </item> 58 {{ end }} 59 </channel> 60 </rss> 61 `}, 62 {`_default/sitemap.xml`, `{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} 63 <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" 64 xmlns:xhtml="http://www.w3.org/1999/xhtml"> 65 {{ range .Data.Pages }} 66 {{- if .Permalink -}} 67 <url> 68 <loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }} 69 <lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }} 70 <changefreq>{{ . }}</changefreq>{{ end }}{{ if ge .Sitemap.Priority 0.0 }} 71 <priority>{{ .Sitemap.Priority }}</priority>{{ end }}{{ if .IsTranslated }}{{ range .Translations }} 72 <xhtml:link 73 rel="alternate" 74 hreflang="{{ .Language.Lang }}" 75 href="{{ .Permalink }}" 76 />{{ end }} 77 <xhtml:link 78 rel="alternate" 79 hreflang="{{ .Language.Lang }}" 80 href="{{ .Permalink }}" 81 />{{ end }} 82 </url> 83 {{- end -}} 84 {{ end }} 85 </urlset> 86 `}, 87 {`_default/sitemapindex.xml`, `{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} 88 <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> 89 {{ range . }} 90 <sitemap> 91 <loc>{{ .SitemapAbsURL }}</loc> 92 {{ if not .LastChange.IsZero }} 93 <lastmod>{{ .LastChange.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</lastmod> 94 {{ end }} 95 </sitemap> 96 {{ end }} 97 </sitemapindex> 98 `}, 99 {`alias.html`, `<!DOCTYPE html><html><head><title>{{ .Permalink }}</title><link rel="canonical" href="{{ .Permalink }}"/><meta name="robots" content="noindex"><meta charset="utf-8" /><meta http-equiv="refresh" content="0; url={{ .Permalink }}" /></head></html>`}, 100 {`disqus.html`, `{{- $pc := .Site.Config.Privacy.Disqus -}} 101 {{- if not $pc.Disable -}} 102 {{ if .Site.DisqusShortname }}<div id="disqus_thread"></div> 103 <script type="application/javascript"> 104 var disqus_config = function () { 105 {{with .Params.disqus_identifier }}this.page.identifier = '{{ . }}';{{end}} 106 {{with .Params.disqus_title }}this.page.title = '{{ . }}';{{end}} 107 {{with .Params.disqus_url }}this.page.url = '{{ . | html }}';{{end}} 108 }; 109 (function() { 110 if (["localhost", "127.0.0.1"].indexOf(window.location.hostname) != -1) { 111 document.getElementById('disqus_thread').innerHTML = 'Disqus comments not available by default when the website is previewed locally.'; 112 return; 113 } 114 var d = document, s = d.createElement('script'); s.async = true; 115 s.src = '//' + {{ .Site.DisqusShortname }} + '.disqus.com/embed.js'; 116 s.setAttribute('data-timestamp', +new Date()); 117 (d.head || d.body).appendChild(s); 118 })(); 119 </script> 120 <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> 121 <a href="https://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>{{end}} 122 {{- end -}}`}, 123 {`google_analytics.html`, `{{- $pc := .Site.Config.Privacy.GoogleAnalytics -}} 124 {{- if not $pc.Disable }}{{ with .Site.GoogleAnalytics -}} 125 {{ if hasPrefix . "G-"}} 126 <script async src="https://www.googletagmanager.com/gtag/js?id={{ . }}"></script> 127 <script> 128 {{ template "__ga_js_set_doNotTrack" $ }} 129 if (!doNotTrack) { 130 window.dataLayer = window.dataLayer || []; 131 function gtag(){dataLayer.push(arguments);} 132 gtag('js', new Date()); 133 gtag('config', '{{ . }}', { 'anonymize_ip': {{- $pc.AnonymizeIP -}} }); 134 } 135 </script> 136 {{ else if hasPrefix . "UA-" }} 137 <script type="application/javascript"> 138 {{ template "__ga_js_set_doNotTrack" $ }} 139 if (!doNotTrack) { 140 (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ 141 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), 142 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) 143 })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); 144 {{- if $pc.UseSessionStorage }} 145 if (window.sessionStorage) { 146 var GA_SESSION_STORAGE_KEY = 'ga:clientId'; 147 ga('create', '{{ . }}', { 148 'storage': 'none', 149 'clientId': sessionStorage.getItem(GA_SESSION_STORAGE_KEY) 150 }); 151 ga(function(tracker) { 152 sessionStorage.setItem(GA_SESSION_STORAGE_KEY, tracker.get('clientId')); 153 }); 154 } 155 {{ else }} 156 ga('create', '{{ . }}', 'auto'); 157 {{ end -}} 158 {{ if $pc.AnonymizeIP }}ga('set', 'anonymizeIp', true);{{ end }} 159 ga('send', 'pageview'); 160 } 161 </script> 162 {{- end -}} 163 {{- end }}{{ end -}} 164 165 {{- define "__ga_js_set_doNotTrack" -}}{{/* This is also used in the async version. */}} 166 {{- $pc := .Site.Config.Privacy.GoogleAnalytics -}} 167 {{- if not $pc.RespectDoNotTrack -}} 168 var doNotTrack = false; 169 {{- else -}} 170 var dnt = (navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack); 171 var doNotTrack = (dnt == "1" || dnt == "yes"); 172 {{- end -}} 173 {{- end -}}`}, 174 {`google_analytics_async.html`, `{{- $pc := .Site.Config.Privacy.GoogleAnalytics -}} 175 {{- if not $pc.Disable -}} 176 {{ with .Site.GoogleAnalytics }} 177 <script type="application/javascript"> 178 {{ template "__ga_js_set_doNotTrack" $ }} 179 if (!doNotTrack) { 180 window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date; 181 {{- if $pc.UseSessionStorage }} 182 if (window.sessionStorage) { 183 var GA_SESSION_STORAGE_KEY = 'ga:clientId'; 184 ga('create', '{{ . }}', { 185 'storage': 'none', 186 'clientId': sessionStorage.getItem(GA_SESSION_STORAGE_KEY) 187 }); 188 ga(function(tracker) { 189 sessionStorage.setItem(GA_SESSION_STORAGE_KEY, tracker.get('clientId')); 190 }); 191 } 192 {{ else }} 193 ga('create', '{{ . }}', 'auto'); 194 {{ end -}} 195 {{ if $pc.AnonymizeIP }}ga('set', 'anonymizeIp', true);{{ end }} 196 ga('send', 'pageview'); 197 } 198 </script> 199 <script async src='https://www.google-analytics.com/analytics.js'></script> 200 {{ end }} 201 {{- end -}} 202 `}, 203 {`google_news.html`, `{{ if .IsPage }}{{ with .Params.news_keywords }} 204 <meta name="news_keywords" content="{{ range $i, $kw := first 10 . }}{{ if $i }},{{ end }}{{ $kw }}{{ end }}" /> 205 {{ end }}{{ end }}`}, 206 {`opengraph.html`, `<meta property="og:title" content="{{ .Title }}" /> 207 <meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" /> 208 <meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" /> 209 <meta property="og:url" content="{{ .Permalink }}" /> 210 211 {{- with $.Params.images -}} 212 {{- range first 6 . }}<meta property="og:image" content="{{ . | absURL }}" />{{ end -}} 213 {{- else -}} 214 {{- $images := $.Resources.ByType "image" -}} 215 {{- $featured := $images.GetMatch "*feature*" -}} 216 {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} 217 {{- with $featured -}} 218 <meta property="og:image" content="{{ $featured.Permalink }}"/> 219 {{- else -}} 220 {{- with $.Site.Params.images }}<meta property="og:image" content="{{ index . 0 | absURL }}"/>{{ end -}} 221 {{- end -}} 222 {{- end -}} 223 224 {{- if .IsPage }} 225 {{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} 226 <meta property="article:section" content="{{ .Section }}" /> 227 {{ with .PublishDate }}<meta property="article:published_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }} 228 {{ with .Lastmod }}<meta property="article:modified_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }} 229 {{- end -}} 230 231 {{- with .Params.audio }}<meta property="og:audio" content="{{ . }}" />{{ end }} 232 {{- with .Params.locale }}<meta property="og:locale" content="{{ . }}" />{{ end }} 233 {{- with .Site.Params.title }}<meta property="og:site_name" content="{{ . }}" />{{ end }} 234 {{- with .Params.videos }}{{- range . }} 235 <meta property="og:video" content="{{ . | absURL }}" /> 236 {{ end }}{{ end }} 237 238 {{- /* If it is part of a series, link to related articles */}} 239 {{- $permalink := .Permalink }} 240 {{- $siteSeries := .Site.Taxonomies.series }} 241 {{ with .Params.series }}{{- range $name := . }} 242 {{- $series := index $siteSeries ($name | urlize) }} 243 {{- range $page := first 6 $series.Pages }} 244 {{- if ne $page.Permalink $permalink }}<meta property="og:see_also" content="{{ $page.Permalink }}" />{{ end }} 245 {{- end }} 246 {{ end }}{{ end }} 247 248 {{- /* Facebook Page Admin ID for Domain Insights */}} 249 {{- with .Site.Social.facebook_admin }}<meta property="fb:admins" content="{{ . }}" />{{ end }} 250 `}, 251 {`pagination.html`, `{{- $validFormats := slice "default" "terse" }} 252 253 {{- $msg1 := "When passing a map to the internal pagination template, one of the elements must be named 'page', and it must be set to the context of the current page." }} 254 {{- $msg2 := "The 'format' specified in the map passed to the internal pagination template is invalid. Valid choices are: %s." }} 255 256 {{- $page := . }} 257 {{- $format := "default" }} 258 259 {{- if reflect.IsMap . }} 260 {{- with .page }} 261 {{- $page = . }} 262 {{- else }} 263 {{- errorf $msg1 }} 264 {{- end }} 265 {{- with .format }} 266 {{- $format = lower . }} 267 {{- end }} 268 {{- end }} 269 270 {{- if in $validFormats $format }} 271 {{- if gt $page.Paginator.TotalPages 1 }} 272 <ul class="pagination pagination-{{ $format }}"> 273 {{- partial (printf "partials/inline/pagination/%s" $format) $page }} 274 </ul> 275 {{- end }} 276 {{- else }} 277 {{- errorf $msg2 (delimit $validFormats ", ") }} 278 {{- end -}} 279 280 {{/* Format: default 281 {{/* --------------------------------------------------------------------- */}} 282 {{- define "partials/inline/pagination/default" }} 283 {{- with .Paginator }} 284 {{- $currentPageNumber := .PageNumber }} 285 286 {{- with .First }} 287 {{- if ne $currentPageNumber .PageNumber }} 288 <li class="page-item"> 289 <a href="{{ .URL }}" aria-label="First" class="page-link" role="button"><span aria-hidden="true">««</span></a> 290 </li> 291 {{- else }} 292 <li class="page-item disabled"> 293 <a href="#" aria-disabled="true" aria-label="First" class="page-link" role="button" tabindex="-1"><span aria-hidden="true">««</span></a> 294 </li> 295 {{- end }} 296 {{- end }} 297 298 {{- with .Prev }} 299 <li class="page-item"> 300 <a href="{{ .URL }}" aria-label="Previous" class="page-link" role="button"><span aria-hidden="true">«</span></a> 301 </li> 302 {{- else }} 303 <li class="page-item disabled"> 304 <a href="#" aria-disabled="true" aria-label="Previous" class="page-link" role="button" tabindex="-1"><span aria-hidden="true">«</span></a> 305 </li> 306 {{- end }} 307 308 {{- $slots := 5 }} 309 {{- $start := math.Max 1 (sub .PageNumber (math.Floor (div $slots 2))) }} 310 {{- $end := math.Min .TotalPages (sub (add $start $slots) 1) }} 311 {{- if lt (add (sub $end $start) 1) $slots }} 312 {{- $start = math.Max 1 (add (sub $end $slots) 1) }} 313 {{- end }} 314 315 {{- range $k := seq $start $end }} 316 {{- if eq $.Paginator.PageNumber $k }} 317 <li class="page-item active"> 318 <a href="#" aria-current="page" aria-label="Page {{ $k }}" class="page-link" role="button">{{ $k }}</a> 319 </li> 320 {{- else }} 321 <li class="page-item"> 322 <a href="{{ (index $.Paginator.Pagers (sub $k 1)).URL }}" aria-label="Page {{ $k }}" class="page-link" role="button">{{ $k }}</a> 323 </li> 324 {{- end }} 325 {{- end }} 326 327 {{- with .Next }} 328 <li class="page-item"> 329 <a href="{{ .URL }}" aria-label="Next" class="page-link" role="button"><span aria-hidden="true">»</span></a> 330 </li> 331 {{- else }} 332 <li class="page-item disabled"> 333 <a href="#" aria-disabled="true" aria-label="Next" class="page-link" role="button" tabindex="-1"><span aria-hidden="true">»</span></a> 334 </li> 335 {{- end }} 336 337 {{- with .Last }} 338 {{- if ne $currentPageNumber .PageNumber }} 339 <li class="page-item"> 340 <a href="{{ .URL }}" aria-label="Last" class="page-link" role="button"><span aria-hidden="true">»»</span></a> 341 </li> 342 {{- else }} 343 <li class="page-item disabled"> 344 <a href="#" aria-disabled="true" aria-label="Last" class="page-link" role="button" tabindex="-1"><span aria-hidden="true">»»</span></a> 345 </li> 346 {{- end }} 347 {{- end }} 348 {{- end }} 349 {{- end -}} 350 351 {{/* Format: terse 352 {{/* --------------------------------------------------------------------- */}} 353 {{- define "partials/inline/pagination/terse" }} 354 {{- with .Paginator }} 355 {{- $currentPageNumber := .PageNumber }} 356 357 {{- with .First }} 358 {{- if ne $currentPageNumber .PageNumber }} 359 <li class="page-item"> 360 <a href="{{ .URL }}" aria-label="First" class="page-link" role="button"><span aria-hidden="true">««</span></a> 361 </li> 362 {{- end }} 363 {{- end }} 364 365 {{- with .Prev }} 366 <li class="page-item"> 367 <a href="{{ .URL }}" aria-label="Previous" class="page-link" role="button"><span aria-hidden="true">«</span></a> 368 </li> 369 {{- end }} 370 371 {{- $slots := 3 }} 372 {{- $start := math.Max 1 (sub .PageNumber (math.Floor (div $slots 2))) }} 373 {{- $end := math.Min .TotalPages (sub (add $start $slots) 1) }} 374 {{- if lt (add (sub $end $start) 1) $slots }} 375 {{- $start = math.Max 1 (add (sub $end $slots) 1) }} 376 {{- end }} 377 378 {{- range $k := seq $start $end }} 379 {{- if eq $.Paginator.PageNumber $k }} 380 <li class="page-item active"> 381 <a href="#" aria-current="page" aria-label="Page {{ $k }}" class="page-link" role="button">{{ $k }}</a> 382 </li> 383 {{- else }} 384 <li class="page-item"> 385 <a href="{{ (index $.Paginator.Pagers (sub $k 1)).URL }}" aria-label="Page {{ $k }}" class="page-link" role="button">{{ $k }}</a> 386 </li> 387 {{- end }} 388 {{- end }} 389 390 {{- with .Next }} 391 <li class="page-item"> 392 <a href="{{ .URL }}" aria-label="Next" class="page-link" role="button"><span aria-hidden="true">»</span></a> 393 </li> 394 {{- end }} 395 396 {{- with .Last }} 397 {{- if ne $currentPageNumber .PageNumber }} 398 <li class="page-item"> 399 <a href="{{ .URL }}" aria-label="Last" class="page-link" role="button"><span aria-hidden="true">»»</span></a> 400 </li> 401 {{- end }} 402 {{- end }} 403 {{- end }} 404 {{- end -}} 405 `}, 406 {`schema.html`, `<meta itemprop="name" content="{{ .Title }}"> 407 <meta itemprop="description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}"> 408 409 {{- if .IsPage -}} 410 {{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} 411 {{ with .PublishDate }}<meta itemprop="datePublished" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end}} 412 {{ with .Lastmod }}<meta itemprop="dateModified" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end}} 413 <meta itemprop="wordCount" content="{{ .WordCount }}"> 414 415 {{- with $.Params.images -}} 416 {{- range first 6 . -}}<meta itemprop="image" content="{{ . | absURL }}">{{ end -}} 417 {{- else -}} 418 {{- $images := $.Resources.ByType "image" -}} 419 {{- $featured := $images.GetMatch "*feature*" -}} 420 {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} 421 {{- with $featured -}} 422 <meta itemprop="image" content="{{ $featured.Permalink }}"> 423 {{- else -}} 424 {{- with $.Site.Params.images -}}<meta itemprop="image" content="{{ index . 0 | absURL }}"/>{{ end -}} 425 {{- end -}} 426 {{- end -}} 427 428 <!-- Output all taxonomies as schema.org keywords --> 429 <meta itemprop="keywords" content="{{ if .IsPage}}{{ range $index, $tag := .Params.tags }}{{ $tag }},{{ end }}{{ else }}{{ range $plural, $terms := .Site.Taxonomies }}{{ range $term, $val := $terms }}{{ printf "%s," $term }}{{ end }}{{ end }}{{ end }}" /> 430 {{- end -}} 431 `}, 432 {`shortcodes/__h_simple_assets.html`, `{{ define "__h_simple_css" }}{{/* These template definitions are global. */}} 433 {{- if not (.Page.Scratch.Get "__h_simple_css") -}} 434 {{/* Only include once */}} 435 {{- .Page.Scratch.Set "__h_simple_css" true -}} 436 <style> 437 .__h_video { 438 position: relative; 439 padding-bottom: 56.23%; 440 height: 0; 441 overflow: hidden; 442 width: 100%; 443 background: #000; 444 } 445 .__h_video img { 446 width: 100%; 447 height: auto; 448 color: #000; 449 } 450 .__h_video .play { 451 height: 72px; 452 width: 72px; 453 left: 50%; 454 top: 50%; 455 margin-left: -36px; 456 margin-top: -36px; 457 position: absolute; 458 cursor: pointer; 459 } 460 </style> 461 {{- end -}} 462 {{- end -}} 463 {{- define "__h_simple_icon_play" -}} 464 <svg version="1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 61 61"><circle cx="30.5" cy="30.5" r="30.5" opacity=".8" fill="#000"></circle><path d="M25.3 19.2c-2.1-1.2-3.8-.2-3.8 2.2v18.1c0 2.4 1.7 3.4 3.8 2.2l16.6-9.1c2.1-1.2 2.1-3.2 0-4.4l-16.6-9z" fill="#fff"></path></svg> 465 {{- end -}} 466 `}, 467 {`shortcodes/figure.html`, `<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}> 468 {{- if .Get "link" -}} 469 <a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}> 470 {{- end -}} 471 <img src="{{ .Get "src" }}" 472 {{- if or (.Get "alt") (.Get "caption") }} 473 alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}" 474 {{- end -}} 475 {{- with .Get "width" }} width="{{ . }}"{{ end -}} 476 {{- with .Get "height" }} height="{{ . }}"{{ end -}} 477 /><!-- Closing img tag --> 478 {{- if .Get "link" }}</a>{{ end -}} 479 {{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}} 480 <figcaption> 481 {{ with (.Get "title") -}} 482 <h4>{{ . }}</h4> 483 {{- end -}} 484 {{- if or (.Get "caption") (.Get "attr") -}}<p> 485 {{- .Get "caption" | markdownify -}} 486 {{- with .Get "attrlink" }} 487 <a href="{{ . }}"> 488 {{- end -}} 489 {{- .Get "attr" | markdownify -}} 490 {{- if .Get "attrlink" }}</a>{{ end }}</p> 491 {{- end }} 492 </figcaption> 493 {{- end }} 494 </figure> 495 `}, 496 {`shortcodes/gist.html`, `<script type="application/javascript" src="https://gist.github.com/{{ index .Params 0 }}/{{ index .Params 1 }}.js{{if len .Params | eq 3 }}?file={{ index .Params 2 }}{{end}}"></script> 497 `}, 498 {`shortcodes/highlight.html`, `{{ if len .Params | eq 2 }}{{ highlight (trim .Inner "\n\r") (.Get 0) (.Get 1) }}{{ else }}{{ highlight (trim .Inner "\n\r") (.Get 0) "" }}{{ end }}`}, 499 {`shortcodes/instagram.html`, `{{- $pc := site.Config.Privacy.Instagram -}} 500 {{- if not $pc.Disable -}} 501 {{ $accessToken := site.Config.Services.Instagram.AccessToken }} 502 {{- if not $accessToken -}} 503 {{- erroridf "error-missing-instagram-accesstoken" "instagram shortcode: Missing config value for services.instagram.accessToken. This can be set in config.toml, but it is recommended to configure this via the HUGO_SERVICES_INSTAGRAM_ACCESSTOKEN OS environment variable. If you are using a Client Access Token, remember that you must combine it with your App ID using a pipe symbol (<APPID>|<CLIENTTOKEN>) otherwise the request will fail." -}} 504 {{- else -}} 505 {{- if $pc.Simple -}} 506 {{ template "_internal/shortcodes/instagram_simple.html" . }} 507 {{- else -}} 508 {{ $id := .Get 0 }} 509 {{ $hideCaption := cond (eq (.Get 1) "hidecaption") "1" "0" }} 510 {{ $headers := dict "Authorization" (printf "Bearer %s" $accessToken) }} 511 {{ with getJSON "https://graph.facebook.com/v8.0/instagram_oembed/?url=https://instagram.com/p/" $id "/&hidecaption=" $hideCaption $headers }} 512 {{ .html | safeHTML }} 513 {{ end }} 514 {{- end -}} 515 {{- end -}} 516 {{- end -}}`}, 517 {`shortcodes/instagram_simple.html`, `{{- $pc := .Page.Site.Config.Privacy.Instagram -}} 518 {{- $sc := .Page.Site.Config.Services.Instagram -}} 519 {{- if not $pc.Disable -}} 520 {{ $accessToken := site.Config.Services.Instagram.AccessToken }} 521 {{- if not $accessToken -}} 522 {{- erroridf "error-missing-instagram-accesstoken" "instagram shortcode: Missing config value for services.instagram.accessToken. This can be set in config.toml, but it is recommended to configure this via the HUGO_SERVICES_INSTAGRAM_ACCESSTOKEN OS environment variable. If you are using a Client Access Token, remember that you must combine it with your App ID using a pipe symbol (<APPID>|<CLIENTTOKEN>) otherwise the request will fail." -}} 523 {{- else -}} 524 {{- $id := .Get 0 -}} 525 {{- $headers := dict "Authorization" (printf "Bearer %s" $accessToken) -}} 526 {{- $item := getJSON "https://graph.facebook.com/v8.0/instagram_oembed/?url=https://instagram.com/p/" $id "/&maxwidth=640&omitscript=true" $headers -}} 527 {{- $class1 := "__h_instagram" -}} 528 {{- $class2 := "s_instagram_simple" -}} 529 {{- $hideCaption := (eq (.Get 1) "hidecaption") -}} 530 {{ with $item }} 531 {{- $mediaURL := printf "https://instagram.com/p/%s/" $id | safeURL -}} 532 {{- if not $sc.DisableInlineCSS -}} 533 {{ template "__h_simple_instagram_css" $ }} 534 {{- end -}} 535 <div class="{{ $class1 }} {{ $class2 }} card" style="max-width: {{ $item.thumbnail_width }}px"> 536 <div class="card-header"> 537 <a href="{{ $item.author_url | safeURL }}" class="card-link"> 538 {{ $item.author_name }} 539 </a> 540 </div> 541 <a href="{{ $mediaURL }}" rel="noopener" target="_blank"> 542 <img class="card-img-top img-fluid" src="{{ $item.thumbnail_url }}" width="{{ $item.thumbnail_width }}" height="{{ $item.thumbnail_height }}" alt="Instagram Image"> 543 </a> 544 <div class="card-body"> 545 {{ if not $hideCaption }} 546 <p class="card-text"> 547 <a href="{{ $item.author_url | safeURL }}" class="card-link"> 548 {{ $item.author_name }} 549 </a> 550 {{ $item.title}} 551 </p> 552 {{ end }} 553 <a href="{{ $item.author_url | safeURL }}" class="card-link"> 554 View More on Instagram 555 </a> 556 </div> 557 </div> 558 {{ end }} 559 {{- end -}} 560 {{- end -}} 561 562 {{ define "__h_simple_instagram_css" }} 563 {{ if not (.Page.Scratch.Get "__h_simple_instagram_css") }} 564 {{/* Only include once */}} 565 {{ .Page.Scratch.Set "__h_simple_instagram_css" true }} 566 <style type="text/css"> 567 .__h_instagram.card { 568 font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif; 569 font-size: 14px; 570 border: 1px solid rgb(219, 219, 219); 571 padding: 0; 572 margin-top: 30px; 573 } 574 .__h_instagram.card .card-header, .__h_instagram.card .card-body { 575 padding: 10px 10px 10px; 576 } 577 .__h_instagram.card img { 578 width: 100%; 579 height: auto; 580 } 581 </style> 582 {{ end }} 583 {{ end }}`}, 584 {`shortcodes/param.html`, `{{- $name := (.Get 0) -}} 585 {{- with $name -}} 586 {{- with ($.Page.Param .) }}{{ . }}{{ else }}{{ errorf "Param %q not found: %s" $name $.Position }}{{ end -}} 587 {{- else }}{{ errorf "Missing param key: %s" $.Position }}{{ end -}}`}, 588 {`shortcodes/ref.html`, `{{ ref . .Params }}`}, 589 {`shortcodes/relref.html`, `{{ relref . .Params }}`}, 590 {`shortcodes/twitter.html`, `{{- $pc := .Page.Site.Config.Privacy.Twitter -}} 591 {{- if not $pc.Disable -}} 592 {{- if $pc.Simple -}} 593 {{- template "_internal/shortcodes/twitter_simple.html" . -}} 594 {{- else -}} 595 {{- $msg1 := "The %q shortcode requires two named parameters: user and id. See %s" -}} 596 {{- $msg2 := "The %q shortcode will soon require two named parameters: user and id. See %s" -}} 597 {{- if .IsNamedParams -}} 598 {{- $id := .Get "id" -}} 599 {{- $user := .Get "user" -}} 600 {{- if and $id $user -}} 601 {{- template "render-tweet" (dict "id" $id "user" $user "dnt" $pc.EnableDNT) -}} 602 {{- else -}} 603 {{- errorf $msg1 .Name .Position -}} 604 {{- end -}} 605 {{- else -}} 606 {{- $id := .Get 1 -}} 607 {{- $user := .Get 0 -}} 608 {{- if eq 1 (len .Params) -}} 609 {{- $id = .Get 0 -}} 610 {{- $user = "x" -}} {{/* This triggers a redirect. It works, but may not work forever. */}} 611 {{- warnf $msg2 .Name .Position -}} 612 {{- end -}} 613 {{- template "render-tweet" (dict "id" $id "user" $user "dnt" $pc.EnableDNT) -}} 614 {{- end -}} 615 {{- end -}} 616 {{- end -}} 617 618 {{- define "render-tweet" -}} 619 {{- $url := printf "https://twitter.com/%v/status/%v" .user .id -}} 620 {{- $query := querify "url" $url "dnt" .dnt -}} 621 {{- $request := printf "https://publish.twitter.com/oembed?%s" $query -}} 622 {{- $json := getJSON $request -}} 623 {{- $json.html | safeHTML -}} 624 {{- end -}} 625 `}, 626 {`shortcodes/twitter_simple.html`, `{{- $pc := .Page.Site.Config.Privacy.Twitter -}} 627 {{- $sc := .Page.Site.Config.Services.Twitter -}} 628 {{- if not $pc.Disable -}} 629 {{- $msg1 := "The %q shortcode requires two named parameters: user and id. See %s" -}} 630 {{- $msg2 := "The %q shortcode will soon require two named parameters: user and id. See %s" -}} 631 {{- if .IsNamedParams -}} 632 {{- $id := .Get "id" -}} 633 {{- $user := .Get "user" -}} 634 {{- if and $id $user -}} 635 {{- template "render-simple-tweet" (dict "id" $id "user" $user "dnt" $pc.EnableDNT "disableInlineCSS" $sc.DisableInlineCSS "ctx" .) -}} 636 {{- else -}} 637 {{- errorf $msg1 .Name .Position -}} 638 {{- end -}} 639 {{- else -}} 640 {{- $id := .Get 1 -}} 641 {{- $user := .Get 0 -}} 642 {{- if eq 1 (len .Params) -}} 643 {{- $id = .Get 0 -}} 644 {{- $user = "x" -}} {{/* This triggers a redirect. It works, but may not work forever. */}} 645 {{- warnf $msg2 .Name .Position -}} 646 {{- end -}} 647 {{- template "render-simple-tweet" (dict "id" $id "user" $user "dnt" $pc.EnableDNT "disableInlineCSS" $sc.DisableInlineCSS "ctx" .) -}} 648 {{- end -}} 649 {{- end -}} 650 651 {{- define "render-simple-tweet" -}} 652 {{- $url := printf "https://twitter.com/%v/status/%v" .user .id -}} 653 {{- $query := querify "url" $url "dnt" .dnt "omit_script" true -}} 654 {{- $request := printf "https://publish.twitter.com/oembed?%s" $query -}} 655 {{- $json := getJSON $request -}} 656 {{- if not .disableInlineCSS -}} 657 {{- template "__h_simple_twitter_css" .ctx -}} 658 {{- end }} 659 {{ $json.html | safeHTML -}} 660 {{- end -}} 661 662 {{- define "__h_simple_twitter_css" -}} 663 {{- if not (.Page.Scratch.Get "__h_simple_twitter_css") -}} 664 {{/* Only include once */}} 665 {{- .Page.Scratch.Set "__h_simple_twitter_css" true }} 666 <style type="text/css"> 667 .twitter-tweet { 668 font: 14px/1.45 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif; 669 border-left: 4px solid #2b7bb9; 670 padding-left: 1.5em; 671 color: #555; 672 } 673 .twitter-tweet a { 674 color: #2b7bb9; 675 text-decoration: none; 676 } 677 blockquote.twitter-tweet a:hover, 678 blockquote.twitter-tweet a:focus { 679 text-decoration: underline; 680 } 681 </style> 682 {{- end -}} 683 {{- end -}} 684 `}, 685 {`shortcodes/vimeo.html`, `{{- $pc := .Page.Site.Config.Privacy.Vimeo -}} 686 {{- if not $pc.Disable -}} 687 {{- if $pc.Simple -}} 688 {{ template "_internal/shortcodes/vimeo_simple.html" . }} 689 {{- else -}} 690 {{ if .IsNamedParams }}<div {{ if .Get "class" }}class="{{ .Get "class" }}"{{ else }}style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;"{{ end }}> 691 <iframe src="https://player.vimeo.com/video/{{ .Get "id" }}{{- if $pc.EnableDNT -}}?dnt=1{{- end -}}" {{ if not (.Get "class") }}style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" {{ end }}{{ if .Get "title"}}title="{{ .Get "title" }}"{{ else }}title="vimeo video"{{ end }} webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> 692 </div>{{ else }} 693 <div {{ if gt (len .Params) 1 }}class="{{ .Get 1 }}"{{ else }}style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;"{{ end }}> 694 <iframe src="https://player.vimeo.com/video/{{ .Get 0 }}{{- if $pc.EnableDNT -}}?dnt=1{{- end -}}" {{ if len .Params | eq 1 }}style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" {{ end }}{{ if len .Params | eq 3 }}title="{{ .Get 2 }}"{{ else }}title="vimeo video"{{ end }} webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> 695 </div> 696 {{ end }} 697 {{- end -}} 698 {{- end -}}`}, 699 {`shortcodes/vimeo_simple.html`, `{{- $pc := .Page.Site.Config.Privacy.Vimeo -}} 700 {{- if not $pc.Disable -}} 701 {{ $id := .Get "id" | default (.Get 0) }} 702 {{ $dnt := cond (eq $pc.EnableDNT true) "?dnt=1" "" }} 703 {{- $item := getJSON (print "https://vimeo.com/api/oembed.json?url=https://vimeo.com/" $id $dnt) -}} 704 {{ $class := .Get "class" | default (.Get 1) }} 705 {{ $hasClass := $class }} 706 {{ $class := $class | default "__h_video" }} 707 {{ if not $hasClass }} 708 {{/* If class is set, assume the user wants to provide his own styles. */}} 709 {{ template "__h_simple_css" $ }} 710 {{ end }} 711 {{ $secondClass := "s_video_simple" }} 712 <div class="{{ $secondClass }} {{ $class }}"> 713 {{- with $item }} 714 <a href="{{ .provider_url }}{{ .video_id }}" rel="noopener" target="_blank"> 715 {{ $thumb := .thumbnail_url }} 716 {{ $original := $thumb | replaceRE "(_.*\\.)" "." }} 717 <img src="{{ $thumb }}" srcset="{{ $thumb }} 1x, {{ $original }} 2x" alt="{{ .title }}"> 718 <div class="play">{{ template "__h_simple_icon_play" $ }}</div></a></div> 719 {{- end -}} 720 {{- end -}}`}, 721 {`shortcodes/youtube.html`, `{{- $pc := .Page.Site.Config.Privacy.YouTube -}} 722 {{- if not $pc.Disable -}} 723 {{- $ytHost := cond $pc.PrivacyEnhanced "www.youtube-nocookie.com" "www.youtube.com" -}} 724 {{- $id := .Get "id" | default (.Get 0) -}} 725 {{- $class := .Get "class" | default (.Get 1) -}} 726 {{- $title := .Get "title" | default "YouTube Video" }} 727 <div {{ with $class }}class="{{ . }}"{{ else }}style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;"{{ end }}> 728 <iframe src="https://{{ $ytHost }}/embed/{{ $id }}{{ with .Get "autoplay" }}{{ if eq . "true" }}?autoplay=1{{ end }}{{ end }}" {{ if not $class }}style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" {{ end }}allowfullscreen title="{{ $title }}"></iframe> 729 </div> 730 {{ end -}} 731 `}, 732 {`twitter_cards.html`, `{{- with $.Params.images -}} 733 <meta name="twitter:card" content="summary_large_image"/> 734 <meta name="twitter:image" content="{{ index . 0 | absURL }}"/> 735 {{ else -}} 736 {{- $images := $.Resources.ByType "image" -}} 737 {{- $featured := $images.GetMatch "*feature*" -}} 738 {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} 739 {{- with $featured -}} 740 <meta name="twitter:card" content="summary_large_image"/> 741 <meta name="twitter:image" content="{{ $featured.Permalink }}"/> 742 {{- else -}} 743 {{- with $.Site.Params.images -}} 744 <meta name="twitter:card" content="summary_large_image"/> 745 <meta name="twitter:image" content="{{ index . 0 | absURL }}"/> 746 {{ else -}} 747 <meta name="twitter:card" content="summary"/> 748 {{- end -}} 749 {{- end -}} 750 {{- end }} 751 <meta name="twitter:title" content="{{ .Title }}"/> 752 <meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}"/> 753 {{ with .Site.Social.twitter -}} 754 <meta name="twitter:site" content="@{{ . }}"/> 755 {{ end -}} 756 `}, 757 }