photo list
This commit is contained in:
parent
98e9a3b9d2
commit
10e0bde07b
|
@ -66,6 +66,25 @@
|
|||
}
|
||||
|
||||
hgroup h2 a { color: inherit; }
|
||||
|
||||
.photo-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
.photo-grid-item {
|
||||
flex: 1 0 25%;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.photo-grid-item img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
aspect-ratio: 1 / 1 ;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<div class="h-feed photo-grid">
|
||||
{{range .}}
|
||||
<div class="h-entry photo-grid-item">
|
||||
<a class="u-url" href="{{.UrlPath}}">
|
||||
<img class="u-photo" src="{{.UrlPath}}media/{{.Meta.PhotoPath}}" alt="{{.Meta.Description}}" />
|
||||
</a>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
|
@ -163,7 +163,14 @@ func RenderIndexPage(user User) (string, error) {
|
|||
|
||||
func RenderPostList(user User, list *PostList) (string, error) {
|
||||
posts, _ := user.GetPostsOfList(*list)
|
||||
postHtml, err := renderEmbedTemplate("embed/post-list.html", posts)
|
||||
var postHtml string
|
||||
var err error
|
||||
if list.ListType == "photo" {
|
||||
postHtml, err = renderEmbedTemplate("embed/post-list-photo.html", posts)
|
||||
} else {
|
||||
postHtml, err = renderEmbedTemplate("embed/post-list.html", posts)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue