Skip to content

Commit

Permalink
fix: json-ld, open-graph
Browse files Browse the repository at this point in the history
  • Loading branch information
reuixiy committed Feb 7, 2020
1 parent 04bde37 commit 6dc995a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions layouts/partials/components/json-ld.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
{{- end -}}
{{- $imgsURL := ($Deliver.Scratch.Get "imgsURL") -}}
<!-- Image absURL -->
{{ with $Deliver.Params.images | default $imgsURL -}}
{{- $Deliver.Scratch.Delete "image" -}}
{{- with $Deliver.Params.images | default $imgsURL -}}
{{- $Deliver.Scratch.Delete "images" -}}
{{- range . -}}
{{- $image := . | absURL | safeHTML -}}
{{- $Deliver.Scratch.Add "image" (printf "%s, " $image) -}}
{{- $Deliver.Scratch.Add "images" (slice $image) -}}
{{- end -}}
{{ end }}
{{- $image := (split (strings.TrimSuffix ", " ($Deliver.Scratch.Get "image")) ", ") -}}
{{- end -}}
{{- $images := $Deliver.Scratch.Get "images" -}}
<!-- Author -->
{{- partial "components/author.html" $Deliver -}}
{{- $author := ($Deliver.Scratch.Get "author") -}}
Expand Down Expand Up @@ -83,8 +83,8 @@
"inLanguage" : "{{ $Deliver.Site.LanguageCode }}",
"articleSection": {{ $Deliver.Section }},
"wordCount": {{ $Deliver.WordCount }},
{{ with $Deliver.Params.images | default $imgsURL -}}
"image": {{ $image }},
{{ with $images -}}
"image": {{ . }},
{{ else -}}
{{ with $Deliver.Site.Params.siteLogo -}}
"image": {{ . | absURL }},
Expand Down
14 changes: 7 additions & 7 deletions layouts/partials/components/open-graph.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
{{- end -}}
{{- $imgsURL := ($Deliver.Scratch.Get "imgsURL") -}}
<!-- Image absURL -->
{{ with $Deliver.Params.images | default $imgsURL -}}
{{- $Deliver.Scratch.Delete "image" -}}
{{- with $Deliver.Params.images | default $imgsURL -}}
{{- $Deliver.Scratch.Delete "images" -}}
{{- range . -}}
{{- $image := . | absURL | safeHTML -}}
{{- $Deliver.Scratch.Add "image" (printf "%s, " $image) -}}
{{- $Deliver.Scratch.Add "images" (slice $image) -}}
{{- end -}}
{{ end }}
{{- $image := (split (strings.TrimSuffix ", " ($Deliver.Scratch.Get "image")) ", ") -}}
{{- end -}}
{{- $images := $Deliver.Scratch.Get "images" -}}
<!-- Date -->
{{- partial "components/date.html" $Deliver -}}
{{- $pubDate := ($Deliver.Scratch.Get "pubDate") -}}
Expand Down Expand Up @@ -56,8 +56,8 @@
{{- end -}}
{{- end -}}

{{- with $imgsURL -}}
<meta property="og:image" content="{{ index $image 0 }}" />
{{- with $images -}}
<meta property="og:image" content="{{ index . 0 }}" />
{{ else -}}
{{ with $Deliver.Site.Params.siteLogo -}}
<meta property="og:image" content="{{ . | absURL }}" />
Expand Down

0 comments on commit 6dc995a

Please sign in to comment.