hugo exif tags doesn’t have a tag for WhiteBalance. I don’t know which library it is using to process exif on page but it is not returning any value for following code:
{{ if .Tags.WhiteBalance }}
<div class="exif">
<i class="fa fa-lightbulb"></i> White Balance:
{{ .Tags.WhiteBalance }}
</div>
{{ end }}
I have checked with exifTool, data for White Balance is there. When I output all .Tags it doesn’t have Tag for WhiteBalance. So just curious if it is there in the library that hugo is using or am I missing something.
All other tags that I need are working properly but lot of tags are missing, very basic ones.
other tags are working now but WhiteBalance is still not working. Do I need to format the output of the tag? It has a numeric value, but it is not even displaying it.
I changed code to this:
{{ if .Tags.WhiteBalance }}
<div class="exif">
<i class="fa fa-lightbulb"></i> White Balance:
{{ .Tags.WhiteBalance }} {{ .Format "." }}
</div>
{{ end }}
all most all other tags are working individually, but whitebalance displays only as a part of the display all tags but not individually. when i display all tags it correctly shows 16 as value but individually it returns no value. strange.
that is happening with all .Tags that return boolean values. like ExposureMode is also not working as it returns integer. need to change code than. thanks for your help, not familiar with hu/go code that much.
one more thing, it returns 0 and 1 as values. I want to convert 0: Auto and 1: Manual for display. what would be the easiest way to do that? edit existing exif.html shortcode template?
ok, working now. thanks for you help. just need to change boolean values to text for display now. is there any tutorial guide for that which i can follow.
Firstly, why? Do you think that build time is long because of this?
Secondly, you could slim it down a bit with with:
{{with .Tags.ExposureMode}}
{{ if eq . 1}} Manual {{/* ExposureMode eq 1 */}}
{{ else}} Auto bracket {{/* ExposureMode neither 0 nor 1 */}}
{{end}}
{{ else}} Auto {{/* ExposureMode 0 */}}
{{end}}
with is true in this context for all values not equal zero, so you only have to test dot for 1 in the if(dot is set to .Tags.ExposureMode by the with). The else inside the if is always true if ExposureMode is neither 1 nor 0, and finally the last else is true if ExposureMode is 0 (because then with is false).
If you only have the values 0, 1 and 2, you could probably use a slice like so