Add video link and custom video thumbnail support.
Some checks are pending
ci/woodpecker/push/build Pipeline is pending
Some checks are pending
ci/woodpecker/push/build Pipeline is pending
This commit is contained in:
parent
4da16c32ae
commit
c12fc92f71
@ -5,7 +5,7 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
<meta name="description" content="Captain ALM's City University Portfolio">
|
<meta name="description" content="Captain ALM's City University Portfolio">
|
||||||
<meta name="keywords" content="CaptainALM Captain_ALM Captain ALM portfolio Alfred Manville projects programming hacking cracking">
|
<meta name="keywords" content="CaptainALM Captain_ALM Captain ALM portfolio Alfred Manville projects programming hacking cracking city uni cityuni cuol City University of London mycityuni">
|
||||||
<title>City University Portfolio</title>
|
<title>City University Portfolio</title>
|
||||||
<link rel="stylesheet" href="{{ .Data.CSSBaseURL }}"/>
|
<link rel="stylesheet" href="{{ .Data.CSSBaseURL }}"/>
|
||||||
{{ if .Light }}
|
{{ if .Light }}
|
||||||
@ -155,7 +155,12 @@
|
|||||||
<div class="item-table-360">
|
<div class="item-table-360">
|
||||||
<div id="video-{{ $c }}">
|
<div id="video-{{ $c }}">
|
||||||
{{ if eq .VideoLocation "" }}
|
{{ if eq .VideoLocation "" }}
|
||||||
<img src="{{ $.Data.NoVideoImageLocation }}" alt="No Video" width="360px">
|
<img src="{{.GetVideoThumbnail $.Data.NoVideoImageLocation }}" alt="No Video" width="360px">
|
||||||
|
{{ else }}
|
||||||
|
{{ if .IsVideoLink }}
|
||||||
|
<a href="{{ .VideoLocation }}">
|
||||||
|
<img src="{{ .GetVideoThumbnail $.Data.PlayVideoImageLocation }}" alt="Play Video" title="Play" width="360px">
|
||||||
|
</a>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<script type="application/javascript">
|
<script type="application/javascript">
|
||||||
CreateVideoPlaceholder({{ $c }})
|
CreateVideoPlaceholder({{ $c }})
|
||||||
@ -167,6 +172,7 @@
|
|||||||
</video>
|
</video>
|
||||||
</noscript>
|
</noscript>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"html/template"
|
"html/template"
|
||||||
"math"
|
"math"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -20,6 +21,7 @@ type EntryYaml struct {
|
|||||||
ThumbnailLocations []template.URL `yaml:"thumbnailLocations"`
|
ThumbnailLocations []template.URL `yaml:"thumbnailLocations"`
|
||||||
ImageLocations []template.URL `yaml:"imageLocations"`
|
ImageLocations []template.URL `yaml:"imageLocations"`
|
||||||
ImageAltTexts []string `yaml:"imageAltTexts"`
|
ImageAltTexts []string `yaml:"imageAltTexts"`
|
||||||
|
VideoThumbnailLocation template.URL `yaml:"videoThumbnailLocation"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ImageReference struct {
|
type ImageReference struct {
|
||||||
@ -28,6 +30,18 @@ type ImageReference struct {
|
|||||||
ImageAltText string
|
ImageAltText string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ey EntryYaml) GetVideoThumbnail(usual template.URL) template.URL {
|
||||||
|
if ey.VideoThumbnailLocation == "" {
|
||||||
|
return usual
|
||||||
|
} else {
|
||||||
|
return ey.VideoThumbnailLocation
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ey EntryYaml) IsVideoLink() bool {
|
||||||
|
return strings.EqualFold(ey.VideoContentType, "text/uri-list")
|
||||||
|
}
|
||||||
|
|
||||||
func (ey EntryYaml) GetStartDate() string {
|
func (ey EntryYaml) GetStartDate() string {
|
||||||
return ey.StartDate.Format(dateFormat)
|
return ey.StartDate.Format(dateFormat)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user