customize list layout for typewriter collection entries shown in a grid
This commit is contained in:
parent
b8bc1ad8e6
commit
2ae658ebf3
1 changed files with 148 additions and 0 deletions
148
layouts/collection/list.html
Normal file
148
layouts/collection/list.html
Normal file
|
@ -0,0 +1,148 @@
|
||||||
|
{{- define "main" }}
|
||||||
|
|
||||||
|
{{- if (and site.Params.profileMode.enabled .IsHome) }}
|
||||||
|
{{- partial "index_profile.html" . }}
|
||||||
|
{{- else }} {{/* if not profileMode */}}
|
||||||
|
|
||||||
|
{{- if not .IsHome | and .Title }}
|
||||||
|
<header class="page-header">
|
||||||
|
{{- partial "breadcrumbs.html" . }}
|
||||||
|
<h1>
|
||||||
|
{{ .Title }}
|
||||||
|
{{- if and (or (eq .Kind `term`) (eq .Kind `section`)) (.Param "ShowRssButtonInSectionTermList") }}
|
||||||
|
{{- with .OutputFormats.Get "rss" }}
|
||||||
|
<a href="{{ .RelPermalink }}" title="RSS" aria-label="RSS">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
|
||||||
|
stroke-linecap="round" stroke-linejoin="round" height="23">
|
||||||
|
<path d="M4 11a9 9 0 0 1 9 9" />
|
||||||
|
<path d="M4 4a16 16 0 0 1 16 16" />
|
||||||
|
<circle cx="5" cy="19" r="1" />
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
</h1>
|
||||||
|
{{- if .Description }}
|
||||||
|
<div class="post-description">
|
||||||
|
{{ .Description | markdownify }}
|
||||||
|
</div>
|
||||||
|
{{- end }}
|
||||||
|
</header>
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.grid-container {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* Responsive grid */
|
||||||
|
gap: 10px; /* Space between grid items */
|
||||||
|
margin: 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-entry {
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
padding: 0;
|
||||||
|
border-radius: 8px;
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.entry-cover {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.entry-header {
|
||||||
|
font-size: 1.1rem;
|
||||||
|
display: inline-block;
|
||||||
|
margin: 10px 16px 10px 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-entry p {
|
||||||
|
margin: 0;
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
{{- if .Content }}
|
||||||
|
<div class="post-content">
|
||||||
|
{{- if not (.Param "disableAnchoredHeadings") }}
|
||||||
|
{{- partial "anchored_headings.html" .Content -}}
|
||||||
|
{{- else }}{{ .Content }}{{ end }}
|
||||||
|
</div>
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
|
||||||
|
<div class="grid-container">
|
||||||
|
{{- range .Pages }}
|
||||||
|
<a href="{{ .Permalink }}" class="post-entry">
|
||||||
|
|
||||||
|
|
||||||
|
{{- $isHidden := (.Param "cover.hiddenInList") | default (.Param "cover.hidden") | default false }}
|
||||||
|
{{- partial "cover.html" (dict "cxt" . "IsSingle" false "isHidden" $isHidden) }}
|
||||||
|
<header class="entry-header">
|
||||||
|
<h2 class="entry-hint-parent">
|
||||||
|
<span>{{ .Title }}</span>
|
||||||
|
</h2>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
|
||||||
|
</a>
|
||||||
|
{{- end }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
{{- $pages := union .RegularPages .Sections }}
|
||||||
|
|
||||||
|
{{- if .IsHome }}
|
||||||
|
{{- $pages = where site.RegularPages "Type" "in" site.Params.mainSections }}
|
||||||
|
{{- $pages = where $pages "Params.hiddenInHomeList" "!=" "true" }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- $paginator := .Paginate $pages }}
|
||||||
|
|
||||||
|
{{- if and .IsHome site.Params.homeInfoParams (eq $paginator.PageNumber 1) }}
|
||||||
|
{{- partial "home_info.html" . }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- $term := .Data.Term }}
|
||||||
|
{{- range $index, $page := $paginator.Pages }}
|
||||||
|
|
||||||
|
{{- $class := "post-entry" }}
|
||||||
|
|
||||||
|
{{- $user_preferred := or site.Params.disableSpecial1stPost site.Params.homeInfoParams }}
|
||||||
|
{{- if (and $.IsHome (eq $paginator.PageNumber 1) (eq $index 0) (not $user_preferred)) }}
|
||||||
|
{{- $class = "first-entry" }}
|
||||||
|
{{- else if $term }}
|
||||||
|
{{- $class = "post-entry tag-entry" }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- if gt $paginator.TotalPages 1 }}
|
||||||
|
<footer class="page-footer">
|
||||||
|
<nav class="pagination">
|
||||||
|
{{- if $paginator.HasPrev }}
|
||||||
|
<a class="prev" href="{{ $paginator.Prev.URL | absURL }}">
|
||||||
|
« {{ i18n "prev_page" }}
|
||||||
|
{{- if (.Param "ShowPageNums") }}
|
||||||
|
{{- sub $paginator.PageNumber 1 }}/{{ $paginator.TotalPages }}
|
||||||
|
{{- end }}
|
||||||
|
</a>
|
||||||
|
{{- end }}
|
||||||
|
{{- if $paginator.HasNext }}
|
||||||
|
<a class="next" href="{{ $paginator.Next.URL | absURL }}">
|
||||||
|
{{- i18n "next_page" }}
|
||||||
|
{{- if (.Param "ShowPageNums") }}
|
||||||
|
{{- add 1 $paginator.PageNumber }}/{{ $paginator.TotalPages }}
|
||||||
|
{{- end }} »
|
||||||
|
</a>
|
||||||
|
{{- end }}
|
||||||
|
</nav>
|
||||||
|
</footer>
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- end }}{{/* end profileMode */}}
|
||||||
|
|
||||||
|
{{- end }}{{- /* end main */ -}}
|
Loading…
Add table
Add a link
Reference in a new issue