Files
hugo_serialReader/layouts/_default/list.html
T
2025-05-13 15:51:18 -06:00

187 lines
6.9 KiB
HTML

{{- define "main" }}
{{- if not .IsHome | and .Title }}
<header class="page-header">
<h1>
{{ .Title }}
{{- if (.Param "ShowRssButtonInSectionTermList") }}
{{- $rss := (.OutputFormats.Get "rss") }}
{{- if (eq .Kind `page`) }}
{{- $rss = (.Parent.OutputFormats.Get "rss") }}
{{- end }}
<script>
document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('.read-more-toggle').forEach(button => {
button.addEventListener('click', () => {
const action = button.getAttribute('data-action');
if (action === 'read-more') {
button.previousElementSibling.style.display = 'none';
button.nextElementSibling.style.display = 'inline';
button.style.display = 'none';
} else if (action === 'read-less') {
button.previousElementSibling.style.display = 'block';
button.nextElementSibling.style.display = 'none';
button.style.display = 'none';
}
});
});
});
</script>
{{- with $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 }}
</div>
{{- end }}
<!-- {{- if .Param "taxButtons" }}
<div class="buttons" style="margin:1rem 0;justify-content:left;">
<a class="button" href="/categories/" rel="noopener" title="categories" style="margin: .5rem 1rem .5rem 0;">
<span class="button-inner">
Categories
</span>
</a>
<a class="button" href="/tags/" rel="noopener" title="tags" style="margin: .5rem 1rem .5rem 0;">
<span class="button-inner">
Tags
</span>
</a>
</div>
{{- end }}
{{- if .Param "recipeButtons" }}
<div class="buttons" style="margin:1rem 0;justify-content:left;">
<a class="button" href="/meals/" rel="noopener" title="meals" style="margin: .5rem 1rem .5rem 0;">
<span class="button-inner">
Find by Meal Type
</span>
</a>
<a class="button" href="/diets/" rel="noopener" title="diets" style="margin: .5rem 1rem .5rem 0;">
<button class="read-more-toggle" data-action="read-more">Read More</button>
Find by Diet
</span>
<button class="read-more-toggle" data-action="read-less">Read Less</button>
</div>
{{- end }} -->
</header>
{{- end }}
{{- if .Content }}
<div class="post-content">
{{- if .Truncated }}
<div class="summary">
{{- $summary := .Content | plainify | truncate 300 }}
<p class="truncated">{{ $summary }}</p>
<button class="read-more-toggle" onclick="this.previousElementSibling.style.display='none'; this.nextElementSibling.style.display='inline'; this.style.display='none';">Read More</button>
<div class="full-content" style="display: none;">
{{ .Content }}
</div>
</div>
{{- else }}
<div class="full-content">
{{ .Content }}
</div>
{{- end }}
</div>
{{- end }}
<article class="latest" style="margin: 2rem 3rem">
<div class="entry-content" style="font-size: 1.1rem;">
{{ range ( first 1 .Pages.ByWeight ) }}
<p style="line-height: 1;"><span style="font-weight:600;width:100%;">Recently Published:</span></p>
<p style="line-height: 1;">{{ .Title }}</p>
<a class="entry-link" aria-label="post link to {{ .Title | plainify }}" href="{{ .Permalink }}"></a>
{{- end }}
</div>
</article>
{{- $pages := union .RegularPages .Sections }}
{{- range (sort $pages ".Weight" ".Date") }}
{{- if not (.Param "chapter")}}
<article class="post-entry">
{{- partial "cover.html" (dict "cxt" . "IsSingle" false) }}
<header class="entry-header">
<h2 class="entry-hint-parent">
{{- .Title }}
{{- if .Draft }}
<span class="entry-hint" title="Draft">
<svg xmlns="http://www.w3.org/2000/svg" height="20" viewBox="0 -960 960 960" fill="currentColor">
<path
d="M160-410v-60h300v60H160Zm0-165v-60h470v60H160Zm0-165v-60h470v60H160Zm360 580v-123l221-220q9-9 20-13t22-4q12 0 23 4.5t20 13.5l37 37q9 9 13 20t4 22q0 11-4.5 22.5T862.09-380L643-160H520Zm300-263-37-37 37 37ZM580-220h38l121-122-18-19-19-18-122 121v38Zm141-141-19-18 37 37-18-19Z" />
</svg>
</span>
{{- end }}
</h2>
</header>
<div class="entry-content">
<p>{{ .Summary | plainify | htmlUnescape }}{{ if .Truncated }}...{{ end }}</p>
</div>
{{- if not (.Param "hideMeta") }}
<footer class="entry-footer">
{{- partial "post_meta.html" . -}}
</footer>
{{- end }}
<a class="entry-link" aria-label="post link to {{ .Title | plainify }}" href="{{ .Permalink }}"></a>
</article>
{{- end }}
{{- end }}
{{- range $pages.GroupByParam "part" }}
<div class="archive-year">
<h2 class="archive-year-header">Part&nbsp;{{- .Key }}
<!-- <sup class="archive-count">&nbsp;&nbsp;{{ len .Pages }}</sup> -->
</h2>
{{- range .Pages.GroupByParam "chapter" }}
<div class="archive-month">
<h3 class="archive-month-header">Chapter&nbsp;{{- .Key }}
<!-- <sup class="archive-count">&nbsp;&nbsp;{{ len .Pages }}</sup> -->
</h3>
<div class="archive-posts">
{{- range .Pages }}
{{- if eq .Kind "page" }}
<div class="archive-entry">
<article class="post-entry">
{{- $isHidden := (site.Params.cover.hidden | default site.Params.cover.hiddenInList) }}
{{- partial "cover.html" (dict "cxt" . "IsHome" true "isHidden" $isHidden) }}
<header class="entry-header">
<h2>
{{- .Title }}
{{- if .Draft }}<sup><span class="entry-isdraft">&nbsp;&nbsp;[draft]</span></sup>{{- end }}
</h2>
</header>
{{- if (ne (.Param "hideSummary") true) }}
<div class="entry-content">
<p>{{ .Summary | plainify | htmlUnescape }}{{ if .Truncated }}...{{ end }}</p>
</div>
{{- end }}
{{- if not (.Param "hideMeta") }}
<footer class="entry-footer">
{{- partial "post_meta.html" . -}}
</footer>
{{- end }}
<a class="entry-link" aria-label="post link to {{ .Title | plainify }}" href="{{ .Permalink }}"></a>
</article>
</div>
{{- end }}
{{- end }}
</div>
</div>
{{- end }}
</div>
{{- end }}
{{- end }}{{- /* end main */ -}}