mirror of
				https://github.com/BBaoVanC/bobatheme.git
				synced 2025-10-30 17:53:28 -05:00 
			
		
		
		
	Also use a generic .figure-media class instead of manually specifying both img and video in the CSS Fixes #36 and a draft issue
		
			
				
	
	
		
			24 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| {{ if eq .ResourceType "image" }}
 | |
|     {{/* TODO: figure out whether loading="lazy" should be set because MDN
 | |
|        *       claims that images won't work with JS disabled since it would
 | |
|        *       make tracking possible, but my experience says otherwise
 | |
|        */}}
 | |
|     <img class="figure-media" src="{{ .Permalink }}" {{ with .Params.alt }}alt="{{ . }}"{{ end }} />
 | |
| {{ else if eq .ResourceType "video" }}
 | |
|     <video class="figure-media" controls preload="metadata">
 | |
|         {{ with .Params.alt }}
 | |
|             {{ warnf "video does not support alt text, '%s'" . }}
 | |
|         {{ end }}
 | |
|         <source src="{{ .Permalink }}" />
 | |
|         {{ i18n "browser_no_video_support" }}
 | |
|         <a href="{{ .Permalink }}" target="_blank" rel="noopener">
 | |
|             {{ i18n "browser_no_video_support_link" }}
 | |
|         </a>
 | |
|     </video>
 | |
| {{ else }}
 | |
|     {{/* TODO: could consider implementing more types, listed at:
 | |
|        * https://www.iana.org/assignments/media-types/media-types.xhtml
 | |
|        */}}
 | |
|     {{ errorf "Handling %q resource not supported" .ResourceType }}
 | |
| {{ end }}
 |