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

"Type-specific layouts" separate for single category #165

Open
dzg opened this issue Sep 27, 2021 · 2 comments
Open

"Type-specific layouts" separate for single category #165

dzg opened this issue Sep 27, 2021 · 2 comments

Comments

@dzg
Copy link

dzg commented Sep 27, 2021

Regarding "Type-specific layouts"

site.com/categories works using my defined layout:

But how do I specify the layout for site.com/categories/category1 ?

It lists posts with category1 but I don't see how to customize the layout.

@dzg
Copy link
Author

dzg commented Sep 27, 2021

OK, so it works with

layout: category_archives
layouts:
  category: category

But in my layout category_archives.html how do I get the category being displayed to use in the title?

SOLVED I used {{ page.posts[0].categories[0] }} to grab the category being listed. Leaving this here if someone else needs this ... or if someone knows a better way. Thanks!

@george-gca
Copy link

If you:

  1. want to use different layouts for different categories (like /category/cat1/ and /category/cat2/ with completely different layouts) I think this is not supported
  2. simply want to access the category name inside the layout, you can use page.title, as stated in the docs.

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

2 participants