So, what I’m trying to achieve is a listing page of sorts but I don’t want subpages for details to be exposed. So for now I have index.html
not a listing _index.html
. I like the page resources approach, it’s working great for me except for one thing. I can’t find a way to order the resources in the listing. Ideally I’d have some sort of weight ordering but .ByWeight
doesn’t seem to work with resources.
{{/* layouts/section_name/single.html */}}
{{ partial "head.html" . }}
<div class="site-wrap clearfix">
{{ partial "header.html" . }}
<div class="post p2 p-responsive wrap" role="main">
<div class="measure">
<div class="post-header mb2">
<h1 class="py2">{{ .Title }}</h1>
</div>
<article class="post-content">
{{ .Content }}
</article>
{{ range .Resources.ByType "page" }}
{{ .Render "listing" }}
{{ end }}
</div>
</div>
</div>
{{ partial "footer.html" . }}
And
{{/* layouts/section_name/listing.html */}}
<article>
<h3><a href="{{ .Params.params.url }}" target="_blank">{{ .Title }}</a></h2>
{{ .Content }}
</article>