Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can jekyll use GET parameters?

Tags:

jekyll

I would like to make a categories page.

{% for post in site.categories[CATEGORY_NAME] %}
  <li><a href="{{ post.url }}">{{ post.title }}</a> ({{post.date|date:"%-d %B %Y"}})</li>
{% endfor %}

Is it possible to use a page parameter to fill in CATEGORY_NAME? Then I could have one file category.html which could serve as the index page for multiple categories (i.e. category.html?name=food and category.html?name=animals.

I've found a few plugins that handle this, but it seems like overkill to require a plugin.

  1. https://github.com/zroger/jekyll-categories
  2. http://blog.nitrous.io/2013/08/30/using-jekyll-plugins-on-github-pages.html

Here's the most related forum post I could find.

https://groups.google.com/forum/#!topic/jekyll-rb/y-dq-63Uvy4

If I can't do this without a plug in, is there a good reason?

like image 287
schmmd Avatar asked Feb 15 '23 23:02

schmmd


1 Answers

I think the correct answer is that Jekyll pages must be compiled to html before they are served. This is not possible if the liquid language takes a parameter.

like image 69
schmmd Avatar answered Mar 12 '23 18:03

schmmd