| | |
| | | |
| | | If a featured_image was set in the page's front matter, then that will be used. |
| | | |
| | | If no featured_image was set, this will use the first image from the page's |
| | | images front matter array. |
| | | |
| | | If not set, this will search page resources to find an image that contains the word |
| | | "cover", and if found, returns the path to that resource. |
| | | |
| | | If no featured_image was set, and there's no "cover" image in page resources, then |
| | | this partial returns an empty string (which evaluates to false). |
| | | If no featured_image or images value was set, and there's no "cover" image in page |
| | | resources, then this partial returns an empty string (which evaluates to false). |
| | | |
| | | @return RelPermalink to featured image, or an empty string if not found. |
| | | |
| | |
| | | {{ with $.Resources.GetMatch . }} |
| | | {{ $linkToCover = .RelPermalink }} |
| | | {{ end }} |
| | | {{/* Find the first image with 'cover' in the name in this page bundle. */}} |
| | | {{ else }} |
| | | {{ with .Resources.ByType "image" }} |
| | | {{ with .GetMatch (fmt.Printf "**{%s}*" $matches) }} |
| | | {{ $linkToCover = .RelPermalink }} |
| | | {{/* Use the first value from the images front matter array if present. */}} |
| | | {{ with .Params.images }} |
| | | {{ range first 1 . }} |
| | | {{ with . }} |
| | | {{ $linkToCover = strings.Trim . "/" | urls.AbsURL }} |
| | | {{/* If we find a Page Resource matching the exact value, we use it instead. */}} |
| | | {{ with $.Resources.GetMatch . }} |
| | | {{ $linkToCover = .RelPermalink }} |
| | | {{ end }} |
| | | {{ end }} |
| | | {{ end }} |
| | | {{/* Find the first image with 'cover' in the name in this page bundle. */}} |
| | | {{ else }} |
| | | {{ with .Resources.ByType "image" }} |
| | | {{ with .GetMatch (fmt.Printf "**{%s}*" $matches) }} |
| | | {{ $linkToCover = .RelPermalink }} |
| | | {{ end }} |
| | | {{ end }} |
| | | {{ end }} |
| | | {{ end }} |