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

Add support for different listing format #6

Open
humrochagf opened this issue Nov 19, 2020 · 1 comment
Open

Add support for different listing format #6

humrochagf opened this issue Nov 19, 2020 · 1 comment

Comments

@humrochagf
Copy link
Owner

Currently, the theme has only a list display mode for the posts it would be nice to have another view modes like grid.

@humrochagf
Copy link
Owner Author

The theme has 2 listing templates:

  • layouts/_default/taxonomy.html (to list the posts after selecting a tag)
  • layouts/blog/list.html (to list the blog posts)

The idea is to add a config variable params.listMode where you can set to grid when you want to get the grid behaviour or just don't set anything to get the default behaviour of list.

The code on the template should be something like this:

{{ range .Paginator.Pages }}
  {{ if eq .Site.Params.listMode "grid" }}
    <!-- grid code goes here -->
  {{ else }}
    <article>
      <h2 class="title"><a href="{{ .Permalink }}">{{ .Title }}</a></h2>

      {{ partial "publish" . }}

      <img class="list-image" src="{{ index .Params.images 0 | safeURL }}" alt="{{ .Title }}" title="{{ .Title }}" />

      {{ .Summary }}
    </article>

    <hr>
  {{ end }}
{{ end }}

Repository owner deleted a comment Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant