Carter Rink
Carter Rink

Reputation: 13

Sorting posts by category using Jekyll works locally but not on Github pages?

I have posts in Jekyll sorted by categories that wont display on github pages. The yaml font matter in the post has the categories set to CSS and design but don't display on the category page with the code below:

{% for post in site.categories.CSS %}
    {% if post.url %}
       <a id="h1a" href="{{ post.url }}">{{ post.title }}</a>
        <p id="date">{{ post.author }} • {{ post.date | date: "%b %-d, %Y" }}</p>
        <div id="excerpt">{{ post.excerpt }}  </div>
        <div id="readmore"><a href="{{ post.url | prepend: site.baseurl }}">Read More</a></div>
     {% endif %}
{% endfor %}

It works locally, and the URL path (/css/design/2016/01/10/responsive-web-design-css-viewport.html) shows that the categories are there, but does not display in the link above. Here is my repository, the code above can be found in the css folder of the root directory.

Upvotes: 1

Views: 142

Answers (1)

David Jacquel
David Jacquel

Reputation: 52799

Jekyll 3.x uses categories "as is" : CSS stays CSS.

Jekyll 2.x is down-casing categories : CSS becomes css.

So, on Github pages site.categories.CSS == nil

In order to work locally in Github pages configuration, you can follow install instructions here.

Upvotes: 1

Related Questions