-
Notifications
You must be signed in to change notification settings - Fork 163
Struggling with Categories #224
Comments
Hi,
Category have another property: posts, which regroup all posts having this particular category. |
Thankyou @laedit for your response! I really appreciate it. I have made some progress, but am getting some strange results. I realised that I had not specified my categories correctly. After changing to the following format in my _config.yaml file I got a bit further:
But I then got an error when running the site. Actually the page loaded fine but where each category name should be it showed the message:
So I was getting pretty desperate and found a few posts showing how to do it with razor syntax. Seeing as the reason I tried this in the first place was loving the idea that I could use .net and razor I thought I would give it a go. Using exactly the same blog post files with the same categories, I tried the following razor:
This worked perfectly. So I thought I was on to a winner, but then I couldn't get the pagination to work with razor. @Model.Paginator just seems to be null. I also came accross this blog post (http://lunarfrog.com/blog/2012/05/14/pretzel/) and tried following it. I noticed that it used the _config.yaml setting of paginate_link: instead of paginate_path: which I had seen in Jekyll, but neither worked for me. So I was stuck! Either use Razor and not be able to page my blog posts or use Liquid and not be able to list categories. Nightmare. Any advice would be amazing!! Thanks again, |
Update: So it gets even more confusing! I finally got to the point where locally I was there with everything except for tags and categories so I pushed it to github pages to call it done for the night. (This is with the Jekyll/liquid syntax) Turns out tags and categories are working on github pages! Which is great, problem solved, no weird error messages. BUT - now the pagination is not working! Arghh - I'm giving up for the night, but this is getting very frustrating. Feels like i'm close each time but no cigar. For pagination I had:
which worked fine locally. Again, any help appreciated! |
Yeah, there is some differences between Jekyll and Pretzel, I started to list them here but I haven't made the all tour yet. You don't need to declare all categories in _config.yml, you can declare them on each post. The use of categories in liquid will be available in the next version, but you can use the source to try it now. I haven't played with pagination in Pretzel or Jekyll for now, but it seems that Jekyll use |
I'm struggling to get categories to work too. No matter what category I put in the front matter, it just seems to be ignored. No errors with the --debug switch either. Do I have to have an explicit permalink that include the category? |
If you want the category to be in the url, yes, otherwise you just have access to categories through |
Hi there,
Is there a way to render a list of categories and tags on my homepage?
For example i've tried the following in my index.md and layout.html files:
{% for category in site.categories %}
{{ category | first }}
{% endfor %}
Sorry I'm new to this project and also to Jekyll, so this is probably a stupid question. I agree with previous comments that more documentation would be useful, if I can get up and running with this I am happy to contribute some docs.
I guess I'm struggling to understand what useful data/variables are available based on my posts alone. So for categories and tags, should I be able to get a list automatically at the site level, or do I need to declare them in my _config.yaml?
Thanks for any help you can give me!!
Rob
The text was updated successfully, but these errors were encountered: