github.com/SDLMoe/hugo@v0.47.1/tpl/tplimpl/embedded/templates.autogen.go (about) 1 // Copyright 2018 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 var EmbeddedTemplates = [][2]string{ 20 {`_default/robots.txt`, `User-agent: *`}, 21 {`_default/rss.xml`, `<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 22 <channel> 23 <title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title> 24 <link>{{ .Permalink }}</link> 25 <description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description> 26 <generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }} 27 <language>{{.}}</language>{{end}}{{ with .Site.Author.email }} 28 <managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }} 29 <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }} 30 <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }} 31 <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} 32 {{ with .OutputFormats.Get "RSS" }} 33 {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} 34 {{ end }} 35 {{ range .Data.Pages }} 36 <item> 37 <title>{{ .Title }}</title> 38 <link>{{ .Permalink }}</link> 39 <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> 40 {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}} 41 <guid>{{ .Permalink }}</guid> 42 <description>{{ .Summary | html }}</description> 43 </item> 44 {{ end }} 45 </channel> 46 </rss>`}, 47 {`_default/sitemap.xml`, `<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" 48 xmlns:xhtml="http://www.w3.org/1999/xhtml"> 49 {{ range .Data.Pages }} 50 <url> 51 <loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }} 52 <lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }} 53 <changefreq>{{ . }}</changefreq>{{ end }}{{ if ge .Sitemap.Priority 0.0 }} 54 <priority>{{ .Sitemap.Priority }}</priority>{{ end }}{{ if .IsTranslated }}{{ range .Translations }} 55 <xhtml:link 56 rel="alternate" 57 hreflang="{{ .Lang }}" 58 href="{{ .Permalink }}" 59 />{{ end }} 60 <xhtml:link 61 rel="alternate" 62 hreflang="{{ .Lang }}" 63 href="{{ .Permalink }}" 64 />{{ end }} 65 </url> 66 {{ end }} 67 </urlset>`}, 68 {`_default/sitemapindex.xml`, `<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> 69 {{ range . }} 70 <sitemap> 71 <loc>{{ .SitemapAbsURL }}</loc> 72 {{ if not .LastChange.IsZero }} 73 <lastmod>{{ .LastChange.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</lastmod> 74 {{ end }} 75 </sitemap> 76 {{ end }} 77 </sitemapindex> 78 `}, 79 {`disqus.html`, `{{- $pc := .Page.Site.Config.Privacy.Disqus -}} 80 {{- if not $pc.Disable -}} 81 {{ if .Site.DisqusShortname }}<div id="disqus_thread"></div> 82 <script type="application/javascript"> 83 var disqus_config = function () { 84 {{with .GetParam "disqus_identifier" }}this.page.identifier = '{{ . }}';{{end}} 85 {{with .GetParam "disqus_title" }}this.page.title = '{{ . }}';{{end}} 86 {{with .GetParam "disqus_url" }}this.page.url = '{{ . | html }}';{{end}} 87 }; 88 (function() { 89 if (["localhost", "127.0.0.1"].indexOf(window.location.hostname) != -1) { 90 document.getElementById('disqus_thread').innerHTML = 'Disqus comments not available by default when the website is previewed locally.'; 91 return; 92 } 93 var d = document, s = d.createElement('script'); s.async = true; 94 s.src = '//' + {{ .Site.DisqusShortname }} + '.disqus.com/embed.js'; 95 s.setAttribute('data-timestamp', +new Date()); 96 (d.head || d.body).appendChild(s); 97 })(); 98 </script> 99 <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> 100 <a href="https://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>{{end}} 101 {{- end -}}`}, 102 {`google_analytics.html`, `{{- $pc := .Site.Config.Privacy.GoogleAnalytics -}} 103 {{- if not $pc.Disable -}} 104 {{ with .Site.GoogleAnalytics }} 105 <script type="application/javascript"> 106 {{ template "__ga_js_set_doNotTrack" $ }} 107 if (!doNotTrack) { 108 (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ 109 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), 110 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) 111 })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); 112 {{- if $pc.UseSessionStorage }} 113 if (window.sessionStorage) { 114 var GA_SESSION_STORAGE_KEY = 'ga:clientId'; 115 ga('create', '{{ . }}', { 116 'storage': 'none', 117 'clientId': sessionStorage.getItem(GA_SESSION_STORAGE_KEY) 118 }); 119 ga(function(tracker) { 120 sessionStorage.setItem(GA_SESSION_STORAGE_KEY, tracker.get('clientId')); 121 }); 122 } 123 {{ else }} 124 ga('create', '{{ . }}', 'auto'); 125 {{ end -}} 126 {{ if $pc.AnonymizeIP }}ga('set', 'anonymizeIp', true);{{ end }} 127 ga('send', 'pageview'); 128 } 129 </script> 130 {{ end }} 131 {{- end -}} 132 {{- define "__ga_js_set_doNotTrack" -}}{{/* This is also used in the async version. */}} 133 {{- $pc := .Site.Config.Privacy.GoogleAnalytics -}} 134 {{- if not $pc.RespectDoNotTrack -}} 135 var doNotTrack = false; 136 {{- else -}} 137 var dnt = (navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack); 138 var doNotTrack = (dnt == "1" || dnt == "yes"); 139 {{- end -}} 140 {{- end -}}`}, 141 {`google_analytics_async.html`, `{{- $pc := .Site.Config.Privacy.GoogleAnalytics -}} 142 {{- if not $pc.Disable -}} 143 {{ with .Site.GoogleAnalytics }} 144 <script type="application/javascript"> 145 {{ template "__ga_js_set_doNotTrack" $ }} 146 if (!doNotTrack) { 147 window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date; 148 {{- if $pc.UseSessionStorage }} 149 if (window.sessionStorage) { 150 var GA_SESSION_STORAGE_KEY = 'ga:clientId'; 151 ga('create', '{{ . }}', { 152 'storage': 'none', 153 'clientId': sessionStorage.getItem(GA_SESSION_STORAGE_KEY) 154 }); 155 ga(function(tracker) { 156 sessionStorage.setItem(GA_SESSION_STORAGE_KEY, tracker.get('clientId')); 157 }); 158 } 159 {{ else }} 160 ga('create', '{{ . }}', 'auto'); 161 {{ end -}} 162 {{ if $pc.AnonymizeIP }}ga('set', 'anonymizeIp', true);{{ end }} 163 ga('send', 'pageview'); 164 } 165 </script> 166 <script async src='https://www.google-analytics.com/analytics.js'></script> 167 {{ end }} 168 {{- end -}} 169 `}, 170 {`google_news.html`, `{{ if .IsPage }}{{ with .Params.news_keywords }} 171 <meta name="news_keywords" content="{{ range $i, $kw := first 10 . }}{{ if $i }},{{ end }}{{ $kw }}{{ end }}" /> 172 {{ end }}{{ end }}`}, 173 {`opengraph.html`, `<meta property="og:title" content="{{ .Title }}" /> 174 <meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" /> 175 <meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" /> 176 <meta property="og:url" content="{{ .Permalink }}" /> 177 {{- with .Params.images }}{{ range first 6 . }} 178 <meta property="og:image" content="{{ . | absURL }}" /> 179 {{ end }}{{ end }} 180 181 {{- if .IsPage }} 182 {{- if not .PublishDate.IsZero }}<meta property="article:published_time" content="{{ .PublishDate.Format "2006-01-02T15:04:05-07:00" | safeHTML }}"/> 183 {{ else if not .Date.IsZero }}<meta property="article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}"/> 184 {{ end }} 185 {{- if not .Lastmod.IsZero }}<meta property="article:modified_time" content="{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}"/>{{ end }} 186 {{- else }} 187 {{- if not .Date.IsZero }} 188 <meta property="og:updated_time" content="{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}"/> 189 {{- end }} 190 {{- end }}{{/* .IsPage */}} 191 192 {{- with .Params.audio }}<meta property="og:audio" content="{{ . }}" />{{ end }} 193 {{- with .Params.locale }}<meta property="og:locale" content="{{ . }}" />{{ end }} 194 {{- with .Site.Params.title }}<meta property="og:site_name" content="{{ . }}" />{{ end }} 195 {{- with .Params.videos }} 196 {{- range . }} 197 <meta property="og:video" content="{{ . | absURL }}" /> 198 {{ end }}{{ end }} 199 200 {{- /* If it is part of a series, link to related articles */}} 201 {{- $permalink := .Permalink }} 202 {{- $siteSeries := .Site.Taxonomies.series }}{{ with .Params.series }} 203 {{- range $name := . }} 204 {{- $series := index $siteSeries $name }} 205 {{- range $page := first 6 $series.Pages }} 206 {{- if ne $page.Permalink $permalink }}<meta property="og:see_also" content="{{ $page.Permalink }}" />{{ end }} 207 {{- end }} 208 {{ end }}{{ end }} 209 210 {{- if .IsPage }} 211 {{- range .Site.Authors }}{{ with .Social.facebook }} 212 <meta property="article:author" content="https://www.facebook.com/{{ . }}" />{{ end }}{{ with .Site.Social.facebook }} 213 <meta property="article:publisher" content="https://www.facebook.com/{{ . }}" />{{ end }} 214 <meta property="article:section" content="{{ .Section }}" /> 215 {{- with .Params.tags }}{{ range first 6 . }} 216 <meta property="article:tag" content="{{ . }}" />{{ end }}{{ end }} 217 {{- end }}{{ end }} 218 219 {{- /* Facebook Page Admin ID for Domain Insights */}} 220 {{- with .Site.Social.facebook_admin }}<meta property="fb:admins" content="{{ . }}" />{{ end }}`}, 221 {`pagination.html`, `{{ $pag := $.Paginator }} 222 {{ if gt $pag.TotalPages 1 }} 223 <ul class="pagination"> 224 {{ with $pag.First }} 225 <li class="page-item"> 226 <a href="{{ .URL }}" class="page-link" aria-label="First"><span aria-hidden="true">««</span></a> 227 </li> 228 {{ end }} 229 <li class="page-item{{ if not $pag.HasPrev }} disabled{{ end }}"> 230 <a href="{{ if $pag.HasPrev }}{{ $pag.Prev.URL }}{{ end }}" class="page-link" aria-label="Previous"><span aria-hidden="true">«</span></a> 231 </li> 232 {{ $.Scratch.Set "__paginator.ellipsed" false }} 233 {{ range $pag.Pagers }} 234 {{ $right := sub .TotalPages .PageNumber }} 235 {{ $showNumber := or (le .PageNumber 3) (eq $right 0) }} 236 {{ $showNumber := or $showNumber (and (gt .PageNumber (sub $pag.PageNumber 2)) (lt .PageNumber (add $pag.PageNumber 2))) }} 237 {{ if $showNumber }} 238 {{ $.Scratch.Set "__paginator.ellipsed" false }} 239 {{ $.Scratch.Set "__paginator.shouldEllipse" false }} 240 {{ else }} 241 {{ $.Scratch.Set "__paginator.shouldEllipse" (not ($.Scratch.Get "__paginator.ellipsed") ) }} 242 {{ $.Scratch.Set "__paginator.ellipsed" true }} 243 {{ end }} 244 {{ if $showNumber }} 245 <li class="page-item{{ if eq . $pag }} active{{ end }}"><a class="page-link" href="{{ .URL }}">{{ .PageNumber }}</a></li> 246 {{ else if ($.Scratch.Get "__paginator.shouldEllipse") }} 247 <li class="page-item disabled"><span aria-hidden="true"> … </span></li> 248 {{ end }} 249 {{ end }} 250 <li class="page-item{{ if not $pag.HasNext }} disabled{{ end }}"> 251 <a href="{{ if $pag.HasNext }}{{ $pag.Next.URL }}{{ end }}" class="page-link" aria-label="Next"><span aria-hidden="true">»</span></a> 252 </li> 253 {{ with $pag.Last }} 254 <li class="page-item"> 255 <a href="{{ .URL }}" class="page-link" aria-label="Last"><span aria-hidden="true">»»</span></a> 256 </li> 257 {{ end }} 258 </ul> 259 {{ end }}`}, 260 {`schema.html`, `{{ with .Site.Social.GooglePlus }}<link rel="publisher" href="{{ . }}"/>{{ end }} 261 <meta itemprop="name" content="{{ .Title }}"> 262 <meta itemprop="description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}"> 263 264 {{if .IsPage}}{{ $ISO8601 := "2006-01-02T15:04:05-07:00" }}{{ if not .PublishDate.IsZero }} 265 <meta itemprop="datePublished" content="{{ .PublishDate.Format $ISO8601 | safeHTML }}" />{{ end }} 266 {{ if not .Date.IsZero }}<meta itemprop="dateModified" content="{{ .Date.Format $ISO8601 | safeHTML }}" />{{ end }} 267 <meta itemprop="wordCount" content="{{ .WordCount }}"> 268 {{ with .Params.images }}{{ range first 6 . }} 269 <meta itemprop="image" content="{{ . | absURL }}"> 270 {{ end }}{{ end }} 271 272 <!-- Output all taxonomies as schema.org keywords --> 273 <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 }}" /> 274 {{ end }}`}, 275 {`shortcodes/__h_simple_assets.html`, `{{ define "__h_simple_css" }}{{/* These template definitions are global. */}} 276 {{- if not (.Page.Scratch.Get "__h_simple_css") -}} 277 {{/* Only include once */}} 278 {{- .Page.Scratch.Set "__h_simple_css" true -}} 279 <style> 280 .__h_video { 281 position: relative; 282 padding-bottom: 56.23%; 283 height: 0; 284 overflow: hidden; 285 width: 100%; 286 background: #000; 287 } 288 .__h_video img { 289 width: 100%; 290 height: auto; 291 color: #000; 292 } 293 .__h_video .play { 294 height: 72px; 295 width: 72px; 296 left: 50%; 297 top: 50%; 298 margin-left: -36px; 299 margin-top: -36px; 300 position: absolute; 301 cursor: pointer; 302 } 303 </style> 304 {{- end -}} 305 {{- end -}} 306 {{- define "__h_simple_icon_play" -}} 307 <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> 308 {{- end -}} 309 `}, 310 {`shortcodes/figure.html`, `<!-- image --> 311 <figure{{ with .Get "class" }} class="{{.}}"{{ end }}> 312 {{ if .Get "link"}}<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>{{ end }} 313 <img src="{{ .Get "src" }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}" {{ end }}{{ with .Get "width" }}width="{{.}}" {{ end }}{{ with .Get "height" }}height="{{.}}" {{ end }}/> 314 {{ if .Get "link"}}</a>{{ end }} 315 {{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}} 316 <figcaption>{{ if isset .Params "title" }} 317 <h4>{{ .Get "title" }}</h4>{{ end }} 318 {{ if or (.Get "caption") (.Get "attr")}}<p> 319 {{ .Get "caption" }} 320 {{ with .Get "attrlink"}}<a href="{{.}}"> {{ end }} 321 {{ .Get "attr" }} 322 {{ if .Get "attrlink"}}</a> {{ end }} 323 </p> {{ end }} 324 </figcaption> 325 {{ end }} 326 </figure> 327 <!-- image -->`}, 328 {`shortcodes/gist.html`, `<script type="application/javascript" src="//gist.github.com/{{ index .Params 0 }}/{{ index .Params 1 }}.js{{if len .Params | eq 3 }}?file={{ index .Params 2 }}{{end}}"></script>`}, 329 {`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 }}`}, 330 {`shortcodes/instagram.html`, `{{- $pc := .Page.Site.Config.Privacy.Instagram -}} 331 {{- if not $pc.Disable -}} 332 {{- if $pc.Simple -}} 333 {{ template "_internal/shortcodes/instagram_simple.html" . }} 334 {{- else -}} 335 {{ $id := .Get 0 }} 336 {{ $hideCaption := cond (eq (.Get 1) "hidecaption") "1" "0" }} 337 {{ with getJSON "https://api.instagram.com/oembed/?url=https://instagram.com/p/" $id "/&hidecaption=" $hideCaption }}{{ .html | safeHTML }}{{ end }} 338 {{- end -}} 339 {{- end -}}`}, 340 {`shortcodes/instagram_simple.html`, `{{- $pc := .Page.Site.Config.Privacy.Instagram -}} 341 {{- $sc := .Page.Site.Config.Services.Instagram -}} 342 {{- if not $pc.Disable -}} 343 {{- $id := .Get 0 -}} 344 {{- $item := getJSON "https://api.instagram.com/oembed/?url=https://www.instagram.com/p/" $id "/&maxwidth=640&omitscript=true" -}} 345 {{- $class1 := "__h_instagram" -}} 346 {{- $class2 := "s_instagram_simple" -}} 347 {{- $hideCaption := (eq (.Get 1) "hidecaption") -}} 348 {{ with $item }} 349 {{- $mediaURL := printf "https://instagram.com/p/%s/" $id | safeURL -}} 350 {{- if not $sc.DisableInlineCSS -}} 351 {{ template "__h_simple_instagram_css" $ }} 352 {{- end -}} 353 <div class="{{ $class1 }} {{ $class2 }} card" style="max-width: {{ $item.thumbnail_width }}px"> 354 <div class="card-header"> 355 <a href="{{ $item.author_url | safeURL }}" class="card-link">{{ $item.author_name }}</a> 356 </div> 357 <a href="{{ $mediaURL }}" target="_blank"><img class="card-img-top img-fluid" src="{{ $item.thumbnail_url }}" width="{{ $item.thumbnail_width }}" height="{{ $item.thumbnail_height }}" alt="Instagram Image"></a> 358 <div class="card-body"> 359 {{ if not $hideCaption }}<p class="card-text"><a href="{{ $item.author_url | safeURL }}" class="card-link">{{ $item.author_name }}</a> {{ $item.title}}</p>{{ end }} 360 <a href="{{ $item.author_url | safeURL }}" class="card-link">View More on Instagram</a> 361 </div> 362 </div> 363 {{ end }} 364 {{- end -}} 365 366 {{ define "__h_simple_instagram_css" }} 367 {{ if not (.Page.Scratch.Get "__h_simple_instagram_css") }} 368 {{/* Only include once */}} 369 {{ .Page.Scratch.Set "__h_simple_instagram_css" true }} 370 <style type="text/css"> 371 .__h_instagram.card { 372 font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif; 373 font-size: 14px; 374 border: 1px solid rgb(219, 219, 219); 375 padding: 0; 376 margin-top: 30px; 377 } 378 .__h_instagram.card .card-header, .__h_instagram.card .card-body { 379 padding: 10px 10px 10px; 380 } 381 .__h_instagram.card img { 382 width: 100%; 383 height: auto; 384 } 385 </style> 386 {{ end }} 387 {{ end }}`}, 388 {`shortcodes/ref.html`, `{{ ref .Page .Params }}`}, 389 {`shortcodes/relref.html`, `{{ relref .Page .Params }}`}, 390 {`shortcodes/twitter.html`, `{{- $pc := .Page.Site.Config.Privacy.Twitter -}} 391 {{- if not $pc.Disable -}} 392 {{- if $pc.Simple -}} 393 {{ template "_internal/shortcodes/twitter_simple.html" . }} 394 {{- else -}} 395 {{- $url := printf "https://api.twitter.com/1/statuses/oembed.json?id=%s&dnt=%t" (index .Params 0) $pc.EnableDNT -}} 396 {{- $json := getJSON $url -}} 397 {{ $json.html | safeHTML }} 398 {{- end -}} 399 {{- end -}}`}, 400 {`shortcodes/twitter_simple.html`, `{{- $pc := .Page.Site.Config.Privacy.Twitter -}} 401 {{- $sc := .Page.Site.Config.Services.Twitter -}} 402 {{- if not $pc.Disable -}} 403 {{- $id := .Get 0 -}} 404 {{- $json := getJSON "https://api.twitter.com/1/statuses/oembed.json?id=" $id "&omit_script=true" -}} 405 {{- if not $sc.DisableInlineCSS -}} 406 {{ template "__h_simple_twitter_css" $ }} 407 {{- end -}} 408 {{ $json.html | safeHTML }} 409 {{- end -}} 410 411 {{ define "__h_simple_twitter_css" }} 412 {{ if not (.Page.Scratch.Get "__h_simple_twitter_css") }} 413 {{/* Only include once */}} 414 {{ .Page.Scratch.Set "__h_simple_twitter_css" true }} 415 <style type="text/css"> 416 .twitter-tweet { 417 font: 14px/1.45 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif; 418 border-left: 4px solid #2b7bb9; 419 padding-left: 1.5em; 420 color: #555; 421 } 422 .twitter-tweet a { 423 color: #2b7bb9; 424 text-decoration: none; 425 } 426 blockquote.twitter-tweet a:hover, 427 blockquote.twitter-tweet a:focus { 428 text-decoration: underline; 429 } 430 </style> 431 {{ end }} 432 {{ end }}`}, 433 {`shortcodes/vimeo.html`, `{{- $pc := .Page.Site.Config.Privacy.Vimeo -}} 434 {{- if not $pc.Disable -}} 435 {{- if $pc.Simple -}} 436 {{ template "_internal/shortcodes/vimeo_simple.html" . }} 437 {{- else -}} 438 {{ if .IsNamedParams }}<div {{ if .Get "class" }}class="{{ .Get "class" }}"{{ else }}style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;"{{ end }}> 439 <iframe src="//player.vimeo.com/video/{{ .Get "id" }}" {{ if not (.Get "class") }}style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" {{ end }}webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> 440 </div>{{ else }} 441 <div {{ if len .Params | eq 2 }}class="{{ .Get 1 }}"{{ else }}style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;"{{ end }}> 442 <iframe src="//player.vimeo.com/video/{{ .Get 0 }}" {{ if len .Params | eq 1 }}style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" {{ end }}webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe> 443 </div> 444 {{ end }} 445 {{- end -}} 446 {{- end -}}`}, 447 {`shortcodes/vimeo_simple.html`, `{{ $id := .Get "id" | default (.Get 0) }} 448 {{- $item := getJSON "https://vimeo.com/api/oembed.json?url=https://vimeo.com/" $id -}} 449 {{ $class := .Get "class" | default (.Get 1) }} 450 {{ $hasClass := $class }} 451 {{ $class := $class | default "__h_video" }} 452 {{ if not $hasClass }} 453 {{/* If class is set, assume the user wants to provide his own styles. */}} 454 {{ template "__h_simple_css" $ }} 455 {{ end }} 456 {{ $secondClass := "s_video_simple" }} 457 <div class="{{ $secondClass }} {{ $class }}"> 458 {{- with $item }} 459 <a href="{{ .provider_url }}{{ .video_id | safeHTMLAttr }}" target="_blank"> 460 {{ $thumb := .thumbnail_url }} 461 {{ $original := $thumb | replaceRE "(_.*\\.)" "." }} 462 <img src="{{ $thumb }}" srcset="{{ $thumb }} 1x, {{ $original }} 2x" alt="{{ .title }}"> 463 <div class="play">{{ template "__h_simple_icon_play" $ }}</div></a></div> 464 {{- end -}} 465 `}, 466 {`shortcodes/youtube.html`, `{{- $pc := .Page.Site.Config.Privacy.YouTube -}} 467 {{- if not $pc.Disable -}} 468 {{- $ytHost := cond $pc.PrivacyEnhanced "www.youtube-nocookie.com" "www.youtube.com" -}} 469 {{- $id := .Get "id" | default (.Get 0) -}} 470 {{- $class := .Get "class" | default (.Get 1) }} 471 <div {{ with $class }}class="{{ . }}"{{ else }}style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;"{{ end }}> 472 <iframe src="//{{ $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="YouTube Video"></iframe> 473 </div> 474 {{ end -}} 475 `}, 476 {`twitter_cards.html`, `{{- with $.Params.images -}} 477 <meta name="twitter:card" content="summary_large_image"/> 478 <meta name="twitter:image" content="{{ index . 0 | absURL }}"/> 479 {{ else -}} 480 {{- $images := $.Resources.ByType "image" -}} 481 {{- $featured := $images.GetMatch "*feature*" -}} 482 {{- $featured := cond (ne $featured nil) $featured ($images.GetMatch "{*cover*,*thumbnail*}") -}} 483 {{- with $featured -}} 484 <meta name="twitter:card" content="summary_large_image"/> 485 <meta name="twitter:image" content="{{ $featured.Permalink }}"/> 486 {{- else -}} 487 {{- with $.Site.Params.images -}} 488 <meta name="twitter:card" content="summary_large_image"/> 489 <meta name="twitter:image" content="{{ index . 0 | absURL }}"/> 490 {{ else -}} 491 <meta name="twitter:card" content="summary"/> 492 {{- end -}} 493 {{- end -}} 494 {{- end }} 495 <meta name="twitter:title" content="{{ .Title }}"/> 496 <meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}"/> 497 {{ with .Site.Social.twitter -}} 498 <meta name="twitter:site" content="@{{ . }}"/> 499 {{ end -}} 500 {{ range .Site.Authors }} 501 {{ with .twitter -}} 502 <meta name="twitter:creator" content="@{{ . }}"/> 503 {{ end -}} 504 {{ end -}}`}, 505 }