Only show image if exists

This commit is contained in:
Las Zenow 2012-08-15 17:12:40 +02:00
parent 7d5ca83a36
commit 2e19245f39
3 changed files with 5 additions and 3 deletions

View file

@ -2,7 +2,7 @@
<h1>{{.Title}}</h1> <h1>{{.Title}}</h1>
<p>{{.Description}}</p> <p>{{.Description}}</p>
<img src="{{.Cover}}" alt="{{.Title}}" /> {{if .Cover}}<img src="{{.Cover}}" alt="{{.Title}}" />{{end}}
<ul> <ul>
<li><strong>Author:</strong> {{range .Author}}<a href="/search/?q=author:{{.}}">{{.}}</a>, {{end}}</li> <li><strong>Author:</strong> {{range .Author}}<a href="/search/?q=author:{{.}}">{{.}}</a>, {{end}}</li>
<li><strong>Publisher:</strong> <a href="/search/?q=publisher:{{.Publisher}}">{{.Publisher}}</a></li> <li><strong>Publisher:</strong> <a href="/search/?q=publisher:{{.Publisher}}">{{.Publisher}}</a></li>

View file

@ -12,7 +12,8 @@
<ul> <ul>
{{with .Books}} {{with .Books}}
{{range .}} {{range .}}
<li><a href="/book/{{.Title}}"><img src="{{.CoverSmall}}" alt="{{.Title}}" /><strong>{{.Title}}</strong></a> - {{range .Author}}{{.}}, {{end}}</li> <li><a href="/book/{{.Title}}">{{if .CoverSmall}}<img src="{{.CoverSmall}}" alt="{{.Title}}" />{{end}}
<strong>{{.Title}}</strong></a> - {{range .Author}}{{.}}, {{end}}</li>
{{end}} {{end}}
{{end}} {{end}}
</ul> </ul>

View file

@ -11,7 +11,8 @@
<ul> <ul>
{{with .Books}} {{with .Books}}
{{range .}} {{range .}}
<li><a href="/book/{{.Title}}"><img src="{{.CoverSmall}}" alt="{{.Title}}" /><strong>{{.Title}}</strong></a> - {{range .Author}}{{.}}, {{end}}</li> <li><a href="/book/{{.Title}}">{{if .CoverSmall}}<img src="{{.CoverSmall}}" alt="{{.Title}}" />{{end}}
<strong>{{.Title}}</strong></a> - {{range .Author}}{{.}}, {{end}}</li>
{{end}} {{end}}
{{end}} {{end}}
</ul> </ul>