Skip to content

Commit

Permalink
feat: transform logo_url to able to use site resources (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang authored Nov 25, 2023
1 parent f92d9ff commit db2e206
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions layouts/_default/index.decapcmsconfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,17 @@
{{- $locale := partialCached "decap-cms/functions/locale" . }}
{{- $config.Set "locale" $locale }}
{{- end }}
{{/* Transform Logo URL. */}}
{{- with $config.Get "logo_url" }}
{{- $logoURL := urls.Parse . }}
{{- if eq $logoURL.Scheme "" }}
{{- with resources.Get . }}
{{- $config.Set "logo_url" .Permalink }}
{{- else }}
{{- $config.Set "logo_url" (. | absURL) }}
{{- end }}
{{- else }}
{{- $config.Set "logo_url" . }}
{{- end }}
{{- end }}
{{- transform.Remarshal "yaml" $config.Values | safeHTML -}}

0 comments on commit db2e206

Please sign in to comment.