From b6890bf302b54eca120b802b908ba1ff348c3e53 Mon Sep 17 00:00:00 2001 From: Emiliano Tortorella Date: Fri, 18 Jan 2019 20:51:31 -0500 Subject: [PATCH 1/2] added partial all-posts-list and added a condition to use it. --- layouts/index.html | 81 +++++++++++++++------------- layouts/partials/all-posts-list.html | 16 ++++++ 2 files changed, 59 insertions(+), 38 deletions(-) create mode 100644 layouts/partials/all-posts-list.html diff --git a/layouts/index.html b/layouts/index.html index e541370..1f079a9 100755 --- a/layouts/index.html +++ b/layouts/index.html @@ -12,48 +12,53 @@ {{/* Derive the section name */}} {{ $section_name := index (.Site.Params.mainSections) 0 }} -
- {{/* Use $section_name to get the section title. Use "with" to only show it if it exists */}} - {{ with .Site.GetPage "section" $section_name }} -

- {{ if .Site.Params.index_show_recent }} - Recent {{ .Title }}: - {{ else }} - {{ .Title }}: - {{ end }} -

- {{ end }} + {{ if $.Param "all_post_list" }} + {{ partial "all-posts-list.html" . }} + {{ else }} - {{ $n_posts := $.Param "recent_posts_number" | default 3 }} +
+ {{/* Use $section_name to get the section title. Use "with" to only show it if it exists */}} + {{ with .Site.GetPage "section" $section_name }} +

+ {{ if .Site.Params.index_show_recent }} + Recent {{ .Title }}: + {{ else }} + {{ .Title }}: + {{ end }} +

+ {{ end }} -
- {{/* Range through the first $n_posts items of the section */}} - {{ range (first $n_posts $section) }} -
- {{ partial "summary-with-image.html" . }} -
- {{ end }} -
+ {{ $n_posts := $.Param "recent_posts_number" | default 3 }} - {{ if ge $section_count (add $n_posts 1) }} -
-

{{$.Param "index_more_copy" | default "More" }}

- {{/* 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)) }} -

- - {{ .Title }} - -

- {{ 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 }} - {{$.Param "index_all_copy" | default "All" }} {{.Title }} - {{ end }} +
+ {{/* Range through the first $n_posts items of the section */}} + {{ range (first $n_posts $section) }} +
+ {{ partial "summary-with-image.html" . }} +
+ {{ end }}
- {{ end }} -
+ {{ if ge $section_count (add $n_posts 1) }} +
+

{{$.Param "index_more_copy" | default "More" }}

+ {{/* 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)) }} +

+ + {{ .Title }} + +

+ {{ 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 }} + {{$.Param "index_all_copy" | default "All" }} {{.Title }} + {{ end }} +
+ {{ end }} + +
+ {{ end }} {{ end }} {{ end }} diff --git a/layouts/partials/all-posts-list.html b/layouts/partials/all-posts-list.html new file mode 100644 index 0000000..580d32f --- /dev/null +++ b/layouts/partials/all-posts-list.html @@ -0,0 +1,16 @@ +{{ $n_posts := $.Param "recent_posts_number" | default 3 }} +
+

+ Últimos posts: +

+ +
+ + {{ range (first $n_posts .Pages) }} +
+ {{ partial "summary-with-image.html" . }} +
+ {{ end }} + +
+
From 8a80745eac5f2885546b76ee4ff59d4de14c736e Mon Sep 17 00:00:00 2001 From: Emiliano Tortorella Date: Sat, 19 Jan 2019 09:31:51 -0500 Subject: [PATCH 2/2] Added section links to the all posts list. --- layouts/partials/all-posts-list.html | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/layouts/partials/all-posts-list.html b/layouts/partials/all-posts-list.html index 580d32f..18da19e 100644 --- a/layouts/partials/all-posts-list.html +++ b/layouts/partials/all-posts-list.html @@ -1,10 +1,11 @@ {{ $n_posts := $.Param "recent_posts_number" | default 3 }} +

Últimos posts:

-
+
{{ range (first $n_posts .Pages) }}
@@ -13,4 +14,21 @@ {{ end }}
+ +
+

+ Más posts en nuestras secciones: +

+ {{ range .Sections }} + {{ $post_count := len (.Pages) }} + {{ if ge $post_count 1 }} +

+ + {{ .Name }} + +

+ {{ end }} + {{ end }} +
+