1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-19 16:05:31 -04:00

change a BUNCH of if's to with's to prepare for theme extraction

This commit is contained in:
2019-12-03 12:41:55 -05:00
parent ac0bbc6343
commit 96ad258d36
23 changed files with 153 additions and 104 deletions

View File

@@ -1,5 +1,8 @@
<footer>
<div id="copyright">Content licensed under <a class="no-underline" href="https://creativecommons.org/licenses/by/4.0/" title="Creative Commons Attribution 4.0 International" target="_blank" rel="noopener">CC-BY-4.0</a>, <a class="no-underline" href="{{ .Site.Params.wayback }}" title="View Old Versions on Wayback Machine" id="wayback" target="_blank" rel="noopener">{{ .Site.Params.copyrightFirstYear }} &ndash;</a> {{ now.Format "2006" }}.</div>
<div id="copyright">Content licensed under <a class="no-underline" href="https://creativecommons.org/licenses/by/4.0/" title="Creative Commons Attribution 4.0 International" target="_blank" rel="noopener">CC-BY-4.0</a>, {{ with .Site.Params.wayback }}<a class="no-underline" href="{{ . }}" title="View Old Versions on Wayback Machine" id="wayback" target="_blank" rel="noopener">{{ end }}{{ with .Site.Params.copyrightFirstYear }}{{ . }} &ndash;{{ end }}{{ if .Site.Params.wayback }}</a>{{ end }} {{ now.Format "2006" }}.</div>
<div id="panda"><a class="no-underline" href="https://nationalzoo.si.edu/webcams/panda-cam" title="Live Panda Party!!!11" target="_blank" rel="noopener"><span>&#x1F43C;</span></a></div>
<div id="poweredby"><a class="no-underline" href="https://gohugo.io/" title="Powered by Hugo" id="hugo" target="_blank" rel="noopener">Powered by Hugo.</a> <a class="no-underline" href="{{ .Site.Params.gitRepo }}" title="View Source on GitHub" id="source" target="_blank" rel="noopener">View source.</a></div>
<div id="poweredby">
<a class="no-underline" href="https://gohugo.io/" title="Powered by Hugo" id="hugo" target="_blank" rel="noopener">Powered by Hugo.</a>
{{ with .Site.Params.gitRepo }}<a class="no-underline" href="{{ . }}" title="View Source on GitHub" id="source" target="_blank" rel="noopener">View source.</a>{{ end }}
</div>
</footer>

View File

@@ -1,13 +1,13 @@
<header>
<nav>
<a class="no-underline" href="{{ .Site.BaseURL }}" id="logo" rel="me author" title="{{ .Site.Title }}" aria-label="{{ .Site.Title }}">
{{ partial "logo.html" . }}
{{ partial "logo" . }}
<h1 id="name">{{ .Site.Title }}</h1>
</a>
<ul>
<li><a class="no-underline" href="{{ .Site.BaseURL }}" title="Home">&#x1F3E0;</a></li>
<li><a class="no-underline" href="{{ "notes/" | absURL }}" title="Notes">&#x1F4DD;</a></li>
<li><a class="no-underline" href="https://github.com/{{ .Site.Author.github }}" title="GitHub" target="_blank" rel="me noopener">&#x1F468;&#x200D;&#x1F4BB;</a></li>
{{ with .Site.Author.github }}<li><a class="no-underline" href="https://github.com/{{ . }}" title="GitHub" target="_blank" rel="me noopener">&#x1F468;&#x200D;&#x1F4BB;</a></li>{{ end }}
<li><a class="no-underline" href="&#x6D;&#x61;&#x69;&#x6C;&#x74;&#x6F;&#x3A;&#x6A;&#x61;&#x6B;&#x65;&#x40;&#x6A;&#x61;&#x72;&#x76;&#x2E;&#x69;&#x73;" title="Email Me">&#x1F48C;</a></li>
</ul>
</nav>

View File

@@ -1,5 +1,9 @@
{{- $imagePath := "content/me_large.jpg" -}}
{{- if .Params.image }}{{ $imagePath = (printf "%s%s%s%s" "content" (.OutputFormats.Get "html").RelPermalink "images/" .Params.image ) }}{{ end -}}
{{- $imagePath := "" }}
{{- with .Params.image }}
{{- $imagePath = (printf "%s%s%s%s" "content" ($.OutputFormats.Get "html").RelPermalink "images/" .) }}
{{- else }}
{{- $imagePath = (printf "%s%s" "content" $.Site.Params.defaultimage) }}
{{- end }}
{{- $image := resources.Get $imagePath -}}
<meta property="og:title" content="{{ .Title }}">
@@ -8,10 +12,14 @@
<meta property="og:locale" content="en_US">
<meta property="og:url" content="{{ .Permalink }}">
<meta property="og:description" content="{{ if .Description }}{{ .Description }}{{ else }}{{ .Site.Params.description }}{{ end }}">
<meta property="og:image" content="{{ if .Params.image }}{{ (printf "%s%s%s" (.OutputFormats.Get "html").Permalink "images/" .Params.image ) }}{{ else }}{{ "me_large.jpg" | absURL }}{{ end }}">
<meta property="og:image:width" content="{{ $image.Width }}">
<meta property="og:image:height" content="{{ $image.Height }}">
<meta property="og:image:alt" content="{{ .Title }}">
{{- with $image }}
<meta property="og:image" content="{{ replace .Permalink "/content/" "/" }}">
<meta property="og:image:width" content="{{ .Width }}">
<meta property="og:image:height" content="{{ .Height }}">
<meta property="og:image:alt" content="{{ $.Title }}">
{{- end }}
{{- if .IsPage }}
{{- if not .PublishDate.IsZero }}
<meta property="article:published_time" content="{{ .PublishDate.Format "2006-01-02T15:04:05-07:00" | safeHTMLAttr }}">
@@ -25,11 +33,13 @@
{{- with .Params.tags }}{{ range . }}
<meta property="article:tag" content="{{ . }}">{{ end }}{{ end }}
{{- end }}
<meta property="fb:admins" content="{{ .Site.Author.facebook_id }}">
<meta property="fb:app_id" content="{{ .Site.Params.facebook_app_id }}">
{{ with .Site.Author.facebook_id }}<meta property="fb:admins" content="{{ . }}">{{ end }}
{{ with .Site.Params.facebook_app_id }}<meta property="fb:app_id" content="{{ . }}">{{ end }}
<meta name="twitter:card" content="summary">
<meta name="twitter:domain" content="{{ .Site.Params.domain }}">
<meta name="twitter:site" content="{{ printf "%s%s" "@" .Site.Author.twitter }}">
<meta name="twitter:creator" content="{{ printf "%s%s" "@" .Site.Author.twitter }}">
{{- with .Site.Author.twitter }}
<meta name="twitter:site" content="{{ printf "%s%s" "@" . }}">
<meta name="twitter:creator" content="{{ printf "%s%s" "@" . }}">
{{- end }}
<meta name="twitter:dnt" content="on">
<meta name="twitter:widgets:csp" content="on">

View File

@@ -1,5 +1,7 @@
{{- $imagePath := "content/me_large.jpg" -}}
{{- if .Params.image }}{{ $imagePath = (printf "%s%s%s%s" "content" (.OutputFormats.Get "html").RelPermalink "images/" .Params.image ) }}{{ end -}}
{{- $imagePath := "" }}
{{- with .Params.image }}
{{- $imagePath = (printf "%s%s%s%s" "content" ($.OutputFormats.Get "html").RelPermalink "images/" .) }}
{{- end }}
{{- $image := resources.Get $imagePath -}}
<script type="application/ld+json">
@@ -13,14 +15,14 @@
"datePublished": {{ .PublishDate.Format "2006-01-02T15:04:05-07:00" }},
"dateModified": {{ .PublishDate.Format "2006-01-02T15:04:05-07:00" }},
"keywords": {{ with .Params.tags }}{{ delimit . ", " }}{{ end }},
"description": {{ if .Description }}{{ .Description }}{{ else }}{{ .Site.Params.description }}{{ end }},
"description": {{ with .Description }}{{ . }}{{ else }}{{ .Site.Params.description }}{{ end }},
"wordCount": "{{ .WordCount }}",
"author": {
"@id": "https://jarv.is/#author"
"@id": {{ printf "%s%s" .Site.BaseURL "#author" }}
},
"publisher": {
"@type": "Organization",
"name": {{ .Site.Author.name }},
"name": {{ .Site.Title }},
"url": {{ .Site.BaseURL }},
"logo": {
"@type": "ImageObject",
@@ -28,12 +30,13 @@
"width": "2048",
"height": "2048"
}
},
}{{ with $image }},
"image": {
"@type": "ImageObject",
"url": {{ if .Params.image }}{{ (printf "%s%s%s" (.OutputFormats.Get "html").Permalink "images/" .Params.image ) }}{{ else }}{{ "me_large.jpg" | absURL }}{{ end }},
"width": "{{ $image.Width }}",
"height": "{{ $image.Height }}"
"url": {{ replace .Permalink "/content/" "/" }},
"width": "{{ .Width }}",
"height": "{{ .Height }}"
}
{{- end }}
}
</script>

View File

@@ -1,26 +1,36 @@
{{- with .Site.Author -}}
{{- $image := "" }}
{{- with $.Site.Params.defaultimage }}
{{- $image = resources.Get (printf "%s%s" "content" .) }}
{{- end -}}
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Person",
"@id": {{ printf "%s%s" .Site.BaseURL "#author" }},
"name": {{ .Site.Author.name }},
"url": {{ .Site.BaseURL }},
"description": {{ .Site.Params.description }},
"jobTitle": {{ .Site.Author.jobtitle }},
"@id": {{ printf "%s%s" $.Site.BaseURL "#author" }},
"name": {{ $.Site.Author.name }},
"url": {{ $.Site.BaseURL }},
"description": {{ $.Site.Params.description }},
{{ with .jobtitle }}"jobTitle": {{ . }},{{ end }}
{{- with $image }}
"image": {
"@type": "ImageObject",
"url": {{ "me_large.jpg" | absURL }},
"width": "1200",
"height": "1200"
"url": {{ replace .Permalink "/content/" "/" }},
"width": "{{ .Width }}",
"height": "{{ .Height }}"
},
{{- end }}
"sameAs": [
{{ .Site.BaseURL }},
{{ printf "%s%s" "https://github.com/" .Site.Author.github }},
{{ printf "%s%s" "https://twitter.com/" .Site.Author.twitter }},
{{ printf "%s%s%s" "https://www.linkedin.com/in/" .Site.Author.linkedin "/" }},
{{ printf "%s%s" "https://www.facebook.com/" .Site.Author.facebook }},
{{ printf "%s%s%s" "https://www.instagram.com/" .Site.Author.instagram "/" }},
{{ printf "%s%s" "https://" .Site.Author.mastodon }}
{{ $.Site.BaseURL }},
{{ with .github }}{{ printf "%s%s" "https://github.com/" . }},{{ end }}
{{ with .twitter }}{{ printf "%s%s" "https://twitter.com/" . }},{{ end }}
{{ with .linkedin }}{{ printf "%s%s%s" "https://www.linkedin.com/in/" . "/" }},{{ end }}
{{ with .facebook }}{{ printf "%s%s" "https://www.facebook.com/" . }},{{ end }}
{{ with .instagram }}{{ printf "%s%s%s" "https://www.instagram.com/" . "/" }},{{ end }}
{{ with .mastodon }}{{ printf "%s%s" "https://" . }}{{ end }}
]
}
</script>
{{- end -}}