Working with Collection in Jekyll application


#1

Following the github issue I have posted before,I am facing an issue that my website does not list my collection correctly.

In config.yml, it is written like this :

collections:
  category:
    output: true
  listcourses: 
    output: true

Here the listcourses is the collection I am trying to load on a particular page. You can see on this page, I have to put all the links separately in elements as the site.collection.listcourses loop is not working.

As per discussion, I have also changed iteration over site.listcourses, but it is still not producing any output. The code is now like

`{% for course in site.listcourses %}

  • {{ course.name }}

    {{ course.content | markdownify }}

    Get Started
  • `

    Is there something missing particularly to the application, can you please check once, as I am wasting time on this.

    Any help would be appreciated.


    #2

    Your issue is related to the files. I cloned down your repo and built it locally. All of your listcourses collection .md files and most things in _pages are encoded as UTF-8 with BOM.

    This is causing issues when Jekyll builds your site as it spits out unrendered .md files into your _site folder, instead of generating .html.

    UTF-8 Character Encoding Warning

    If you use UTF-8 encoding, make sure that no BOM header characters exist in your files or very, very bad things will happen to Jekyll. This is especially relevant if you’re running Jekyll on Windows.

    ref: Jekyll docs

    This is why your collection loop isn’t working as well.

    Resave the files as UTF-8 (or remove the BOM header characters) and things should start working for you.

    image

    You also have a lot of duplication of files in your repo that could be fighting between each other, as one overwrites the other. Cleaning that up might help too.


    #3

    Awesome answer… It did work for me. I have just removed the BOM header and it is now working.

    Thank you so much for the help.