add support for videos in posts from social #60
| @ -10,6 +10,13 @@ | |||||||
|               </a></h2> |               </a></h2> | ||||||
|             </header> |             </header> | ||||||
|  |  | ||||||
|  |             {{ with (index (.Resources.ByType "video") 0) }} | ||||||
|  |             {{/* TODO this current logic does not suport video & image mixed */}} | ||||||
|  |               <div class="p-summary"> | ||||||
|  |               <video controls width="540px" preload="none" poster="{{ $postPermalink }}/thumbnail.png"> | ||||||
|  |                 <source src="{{.Permalink}}" type="video/mp4"> | ||||||
|  |               </video> | ||||||
|  |             {{ else}} | ||||||
|             {{ with (index (.Resources.ByType "image") 0) }} |             {{ with (index (.Resources.ByType "image") 0) }} | ||||||
|               {{ $height := add .Height 0.0}} |               {{ $height := add .Height 0.0}} | ||||||
|               {{ $ratio := div $height .Width}} |               {{ $ratio := div $height .Width}} | ||||||
| @ -18,9 +25,10 @@ | |||||||
|               <div class="summary-image {{if gt $ratio 1 }} portrait {{else}} landscape {{end}}">  |               <div class="summary-image {{if gt $ratio 1 }} portrait {{else}} landscape {{end}}">  | ||||||
|               <a href="{{ $postPermalink }}"><img src="{{ $thumb.Permalink }}"  alt="{{ .Title }}"> </a> |               <a href="{{ $postPermalink }}"><img src="{{ $thumb.Permalink }}"  alt="{{ .Title }}"> </a> | ||||||
|             </div> |             </div> | ||||||
|               {{ else }} |             {{ else }} | ||||||
|               <div class="p-summary"> |               <div class="p-summary"> | ||||||
|               {{ end }} |             {{ end }} | ||||||
|  |             {{ end }} | ||||||
|               <div class="summary-text"> |               <div class="summary-text"> | ||||||
|                 {{ .Summary }} |                 {{ .Summary }} | ||||||
|               </div> |               </div> | ||||||
| @ -32,10 +40,10 @@ | |||||||
|               <span class="from p-author">{{ if .Params.authors }}From {{range .Params.authors}}<b> <a href='{{ "/authors/" | relLangURL }}{{ . | urlize }}/'> {{ . }}</a> {{end}}</b> on{{ end }}</span> |               <span class="from p-author">{{ if .Params.authors }}From {{range .Params.authors}}<b> <a href='{{ "/authors/" | relLangURL }}{{ . | urlize }}/'> {{ . }}</a> {{end}}</b> on{{ end }}</span> | ||||||
|                <time class="dt-published" datetime="{{ .Date.Format `Jan 02 2006` }}">{{ .Date.Format "Jan 02, 2006" }}</time> |                <time class="dt-published" datetime="{{ .Date.Format `Jan 02 2006` }}">{{ .Date.Format "Jan 02, 2006" }}</time> | ||||||
|                </div> |                </div> | ||||||
|              {{ if .Truncated }} |               {{ if .Truncated }} | ||||||
|                 <div class="footer-filler"></div> |                 <div class="footer-filler"></div> | ||||||
|                 <div class='read-more'><a href="{{ .RelPermalink }}">Read More…</a></div> |                 <div class='read-more'><a href="{{ .RelPermalink }}">Read More…</a></div> | ||||||
|                 {{ end }} |                 {{ end }} | ||||||
|               </footer>             |             </footer>             | ||||||
|           </article> |           </article> | ||||||
|     </div> |     </div> | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user