support for images in page bundles as relative paths
This commit is contained in:
parent
bedcf7a212
commit
e4a10bab22
7 changed files with 55 additions and 11 deletions
|
|
@ -7,10 +7,16 @@
|
|||
{{ if .IsPage }}
|
||||
<meta name="twitter:title" content="{{ .Title }}" />
|
||||
|
||||
{{ $image := .Site.Params.icon512 | default "/img/icon.svg" }}
|
||||
{{ if .Params.Image }}
|
||||
{{ if or (hasPrefix .Params.Image "/") (hasPrefix .Params.Image "http://") (hasPrefix .Params.Image "https://") }}
|
||||
{{ $image = .Params.Image }}
|
||||
{{ else }}
|
||||
{{ $image = path.Join (path.Join .File.Dir .Params.Image) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
<meta name="twitter:image"
|
||||
content='{{ if .Params.Image }}{{ .Params.Image | absURL }}
|
||||
{{ else }}{{ .Site.Params.icon512 | default "/img/icon.svg" | absURL }}
|
||||
{{ end }}' />
|
||||
content="{{ $image | absURL }}" />
|
||||
{{ if .Params.description }}
|
||||
<meta name="twitter:description" content="{{ .Params.description }}" />
|
||||
{{ else }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue