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

I just converted a site from jekyll to 11ty. How do you do blog categories #776

Closed
distinctperspective opened this issue Nov 17, 2019 · 5 comments

Comments

@distinctperspective
Copy link

I wasnt able to find much on how to use the blog post categories. I got the whole site moved over except the categories.

My site used to take over 45 seconds on Jekyll to rebuild on local machine which is way to slow for development. Takes about 5 seconds for about 350 pages.

I want to move this structure to 11ty...can someone point me in the direction.
https://clocksharkwf.netlify.com/blog
https://clocksharkwf.netlify.com/blog/category/business

I was able to get just the blog index with pagination working but not categories.

@Munter
Copy link
Contributor

Munter commented Nov 17, 2019

If you have categories in your front matter you can access these in your eleventy config while adding collections. Register new collections which are filtered down versions of the original ones, containing only the ones matching your categories.

@Ryuno-Ki
Copy link
Contributor

You can use getFilteredByTag() for that. Treat your categories as tags in Eleventy, for example. Otherwise inspect the data property of a collection item.

@clockshark
Copy link

I figured out the easiest way was this way below

category.html with

pagination:
data: collections
size: 1
alias: tag
filter:
- all
- nav
- post
- posts
- blogposts
- featurepages
permalink: /Blog/Category/{{ tag }}/
layout: home
renderData:
title: "Category “{{ tag }}”"
permalink: /Blog/Category/{{ tag }}/

but now my category pages are not paginated

Any help??

@zachleat
Copy link
Member

Ah this is the double-layer pagination problem. There is a way to do this but it isn’t super friendly right now.

See the example I posted here: #332
Also upvote #461 if you’d like to see a nicer way integrated into core

@zachleat
Copy link
Member

Closing this as a duplicate of the issues above.

This is an automated message to let you know that a helpful response was posted to your issue and for the health of the repository issue tracker the issue will be closed. This is to help alleviate issues hanging open waiting for a response from the original poster.

If the response works to solve your problem—great! But if you’re still having problems, do not let the issue’s closing deter you if you have additional questions! Post another comment and I will reopen the issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants