photo list
This commit is contained in:
parent
98e9a3b9d2
commit
10e0bde07b
|
@ -66,6 +66,25 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
hgroup h2 a { color: inherit; }
|
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>
|
</style>
|
||||||
</head>
|
</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) {
|
func RenderPostList(user User, list *PostList) (string, error) {
|
||||||
posts, _ := user.GetPostsOfList(*list)
|
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 {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
1
user.go
1
user.go
|
@ -36,6 +36,7 @@ type PostList struct {
|
||||||
Id string `yaml:"id"`
|
Id string `yaml:"id"`
|
||||||
Title string `yaml:"title"`
|
Title string `yaml:"title"`
|
||||||
Include []string `yaml:"include"`
|
Include []string `yaml:"include"`
|
||||||
|
ListType string `yaml:"list_type"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MenuItem struct {
|
type MenuItem struct {
|
||||||
|
|
Loading…
Reference in New Issue