mirror of
https://github.com/jbowdre/runtimeterror.git
synced 2024-11-29 09:52:19 +00:00
update draft
This commit is contained in:
parent
ba15df513d
commit
1c92120c7d
1 changed files with 8 additions and 10 deletions
|
@ -132,25 +132,23 @@ This is a great starting point for what I want to accomplish, but I'm going to m
|
||||||
### My tweaks
|
### My tweaks
|
||||||
As I mentioned earlier, I want to have basically three recipes for baking my OG images: one for the homepage, one for standard posts, and one for posts with an associated thumbnail. They'll all use the same basic code, though, so I wanted to be sure that my setup didn't repeat itself too much.
|
As I mentioned earlier, I want to have basically three recipes for baking my OG images: one for the homepage, one for standard posts, and one for posts with an associated thumbnail. They'll all use the same basic code, though, so I wanted to be sure that my setup didn't repeat itself too much.
|
||||||
|
|
||||||
|
I'll start with fetching my resources up front, and initializing a `$text` variable:
|
||||||
|
|
||||||
```jinja-html
|
```jinja-html
|
||||||
// torchlight! {"lineNumbers": true}
|
|
||||||
{{ $img := resources.Get "og_base.png" }}
|
{{ $img := resources.Get "og_base.png" }}
|
||||||
{{ $font := resources.Get "/FiraMono-Regular.ttf" }}
|
{{ $font := resources.Get "/FiraMono-Regular.ttf" }}
|
||||||
{{ $text := "" }}
|
{{ $text := "" }}
|
||||||
<meta property="og:title" content="{{ .Title }}" />
|
```
|
||||||
<meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" />
|
|
||||||
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
|
If it's the homepage, I'll set `$text` to hold the site description:
|
||||||
<meta property="og:url" content="{{ .Permalink }}" />
|
|
||||||
<meta property="og:locale" content="{{ .Lang }}" />
|
```jinja-html
|
||||||
{{- if .IsHome }}
|
{{- if .IsHome }}
|
||||||
{{ $text = .Site.Params.Description }}
|
{{ $text = .Site.Params.Description }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
```
|
||||||
|
|
||||||
{{- if .IsPage }}
|
{{- if .IsPage }}
|
||||||
{{- $iso8601 := "2006-01-02T15:04:05-07:00" -}}
|
|
||||||
<meta property="article:section" content="{{ .Section }}" />
|
|
||||||
{{ with .PublishDate }}<meta property="article:published_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }}
|
|
||||||
{{ with .Lastmod }}<meta property="article:modified_time" {{ .Format $iso8601 | printf "content=%q" | safeHTMLAttr }} />{{ end }}
|
|
||||||
{{ $text = .Page.Title }}
|
{{ $text = .Page.Title }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue