mirror of
https://github.com/theNewDynamic/gohugo-theme-ananke.git
synced 2025-06-08 17:22:46 +00:00
Merge branch 'index-posts-change' into dev
This commit is contained in:
commit
0ec004f3ae
@ -12,48 +12,53 @@
|
|||||||
{{/* Derive the section name */}}
|
{{/* Derive the section name */}}
|
||||||
{{ $section_name := index (.Site.Params.mainSections) 0 }}
|
{{ $section_name := index (.Site.Params.mainSections) 0 }}
|
||||||
|
|
||||||
<div class="pa3 pa4-ns w-100 w-70-ns center">
|
{{ if $.Param "all_post_list" }}
|
||||||
{{/* Use $section_name to get the section title. Use "with" to only show it if it exists */}}
|
{{ partial "all-posts-list.html" . }}
|
||||||
{{ with .Site.GetPage "section" $section_name }}
|
{{ else }}
|
||||||
<h1 class="flex-none">
|
|
||||||
{{ if .Site.Params.index_show_recent }}
|
|
||||||
Recent {{ .Title }}:
|
|
||||||
{{ else }}
|
|
||||||
{{ .Title }}:
|
|
||||||
{{ end }}
|
|
||||||
</h1>
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ $n_posts := $.Param "recent_posts_number" | default 3 }}
|
<div class="pa3 pa4-ns w-100 w-70-ns center">
|
||||||
|
{{/* Use $section_name to get the section title. Use "with" to only show it if it exists */}}
|
||||||
|
{{ with .Site.GetPage "section" $section_name }}
|
||||||
|
<h1 class="flex-none">
|
||||||
|
{{ if .Site.Params.index_show_recent }}
|
||||||
|
Recent {{ .Title }}:
|
||||||
|
{{ else }}
|
||||||
|
{{ .Title }}:
|
||||||
|
{{ end }}
|
||||||
|
</h1>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
<section class="w-100 mw8">
|
{{ $n_posts := $.Param "recent_posts_number" | default 3 }}
|
||||||
{{/* Range through the first $n_posts items of the section */}}
|
|
||||||
{{ range (first $n_posts $section) }}
|
|
||||||
<div class="relative w-100 mb4">
|
|
||||||
{{ partial "summary-with-image.html" . }}
|
|
||||||
</div>
|
|
||||||
{{ end }}
|
|
||||||
</section>
|
|
||||||
|
|
||||||
{{ if ge $section_count (add $n_posts 1) }}
|
<section class="w-100 mw8">
|
||||||
<section class="w-100">
|
{{/* Range through the first $n_posts items of the section */}}
|
||||||
<h1 class="f3">{{$.Param "index_more_copy" | default "More" }}</h1>
|
{{ range (first $n_posts $section) }}
|
||||||
{{/* Now, range through the next four after the initial $n_posts items. Nest the requirements, "after" then "first" on the outside */}}
|
<div class="relative w-100 mb4">
|
||||||
{{ range (first 4 (after $n_posts $section)) }}
|
{{ partial "summary-with-image.html" . }}
|
||||||
<h2 class="f5 fw4 mb4 dib mr3">
|
</div>
|
||||||
<a href="{{ .URL }}" class="link black dim">
|
{{ end }}
|
||||||
{{ .Title }}
|
|
||||||
</a>
|
|
||||||
</h2>
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{/* As above, Use $section_name to get the section title, and URL. Use "with" to only show it if it exists */}}
|
|
||||||
{{ with .Site.GetPage "section" $section_name }}
|
|
||||||
<a href="{{ .URL }}" class="link db f6 pa2 br3 bg-mid-gray white dim w4 tc">{{$.Param "index_all_copy" | default "All" }} {{.Title }}</a>
|
|
||||||
{{ end }}
|
|
||||||
</section>
|
</section>
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
</div>
|
{{ if ge $section_count (add $n_posts 1) }}
|
||||||
|
<section class="w-100">
|
||||||
|
<h1 class="f3">{{$.Param "index_more_copy" | default "More" }}</h1>
|
||||||
|
{{/* Now, range through the next four after the initial $n_posts items. Nest the requirements, "after" then "first" on the outside */}}
|
||||||
|
{{ range (first 4 (after $n_posts $section)) }}
|
||||||
|
<h2 class="f5 fw4 mb4 dib mr3">
|
||||||
|
<a href="{{ .URL }}" class="link black dim">
|
||||||
|
{{ .Title }}
|
||||||
|
</a>
|
||||||
|
</h2>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{/* As above, Use $section_name to get the section title, and URL. Use "with" to only show it if it exists */}}
|
||||||
|
{{ with .Site.GetPage "section" $section_name }}
|
||||||
|
<a href="{{ .URL }}" class="link db f6 pa2 br3 bg-mid-gray white dim w4 tc">{{$.Param "index_all_copy" | default "All" }} {{.Title }}</a>
|
||||||
|
{{ end }}
|
||||||
|
</section>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
34
layouts/partials/all-posts-list.html
Normal file
34
layouts/partials/all-posts-list.html
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
{{ $n_posts := $.Param "recent_posts_number" | default 3 }}
|
||||||
|
|
||||||
|
<div class="pa3 pa4-ns w-100 w-70-ns center">
|
||||||
|
<h1 class="flex-none">
|
||||||
|
Últimos posts:
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<section class="w-100 mw8 center">
|
||||||
|
|
||||||
|
{{ range (first $n_posts .Pages) }}
|
||||||
|
<div class="relative w-100 mb4">
|
||||||
|
{{ partial "summary-with-image.html" . }}
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="w-100">
|
||||||
|
<h1 class="f3 dib">
|
||||||
|
Más posts en nuestras secciones:
|
||||||
|
</h1>
|
||||||
|
{{ range .Sections }}
|
||||||
|
{{ $post_count := len (.Pages) }}
|
||||||
|
{{ if ge $post_count 1 }}
|
||||||
|
<h2 class="f4 fw4 mb4 dib ml3">
|
||||||
|
<a href="{{ .URL }}" class="link black dim">
|
||||||
|
{{ .Name }}
|
||||||
|
</a>
|
||||||
|
</h2>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
</section>
|
||||||
|
|
||||||
|
</div>
|
Loading…
x
Reference in New Issue
Block a user