Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

edit posts layout #181

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@
* **html:** add href for <a> tag ([fc936ae](https://github.com/hugo-sid/hugo-blog-awesome/commit/fc936ae1374e11f9e3447acff73dae69d4eeb889))
* link to license in readme ([91e0cd9](https://github.com/hugo-sid/hugo-blog-awesome/commit/91e0cd972c2c2f6c061c9c0ddd00712fbf7f0c69))
* meta description ([340bd14](https://github.com/hugo-sid/hugo-blog-awesome/commit/340bd14a97dc9665d1b9d0749b9aa54be72690e5))
* recent posts on home page is not correctly filtered ([#23](https://github.com/hugo-sid/hugo-blog-awesome/issues/23)) ([4afdfcb](https://github.com/hugo-sid/hugo-blog-awesome/commit/4afdfcbb47a302395929c3cf015f6b705978e48f))
* Posts on home page is not correctly filtered ([#23](https://github.com/hugo-sid/hugo-blog-awesome/issues/23)) ([4afdfcb](https://github.com/hugo-sid/hugo-blog-awesome/commit/4afdfcbb47a302395929c3cf015f6b705978e48f))
* stretched image ([87c7756](https://github.com/hugo-sid/hugo-blog-awesome/commit/87c775645a5b002e9c9c4e5e0581e11e87f78d54))
* stretched image ([#3](https://github.com/hugo-sid/hugo-blog-awesome/issues/3)) ([5eb9b07](https://github.com/hugo-sid/hugo-blog-awesome/commit/5eb9b07e569fb04080d13a47c5cce4557f36a0f5))
* template failure in bio.html when avatar is not found/defined ([#15](https://github.com/hugo-sid/hugo-blog-awesome/issues/15)) ([295c8a1](https://github.com/hugo-sid/hugo-blog-awesome/commit/295c8a13cdf3f5e928cbc1275dc19e053585d232))
Expand Down
2 changes: 1 addition & 1 deletion i18n/en-gb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
translation: "Home"

- id: "home.recent_posts"
translation: "Recent Posts"
translation: "Posts"

- id: "home.see_all_posts"
translation: "See all posts"
Expand Down
2 changes: 1 addition & 1 deletion i18n/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
translation: "Home"

- id: "home.recent_posts"
translation: "Recent Posts"
translation: "Posts"

- id: "home.see_all_posts"
translation: "See all posts"
Expand Down
15 changes: 5 additions & 10 deletions layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,15 @@
<div class="wrapper">
{{ partial "bio" . }}
<main aria-label="Content">
<h3 class="posts-item-note" aria-label="Recent Posts">{{ T "home.recent_posts" }}</h3>
{{/* Show last 5 posts in reverse date order */}}
<h3 class="posts-item-note" aria-label="Posts">{{ T "home.recent_posts" }}</h3>
{{ $pagesToShow := where .Site.RegularPages "Type" "in" site.Params.mainSections }}
{{ $posts := $pagesToShow.ByDate.Reverse }}
{{ range first 5 $posts }}
{{ range $posts }}
{{ partial "postCard" . }}
{{ end }}
{{ if gt (len $posts) 5 }}
<p>
{{ range $firstSection := (where .Site.Sections "Section" "in" (first 1 (.Site.Params.mainSections))) }}
<a href="{{ $firstSection.Permalink }}">{{ T "home.see_all_posts" }}</a>
{{ end }}
</p>
{{ end }}

{{/* I edited this so it shows all posts, original has 5 recent posts*/}}

</main>
</div>
{{- partial "footer.html" . -}}
Expand Down
Loading