Index | Diary

#### Using a data file ####

This reads from reading.csv and inserts it in to post <ul> {% for reading in site.data.reading %} <li>

By Finished

</a> </li> {% endfor %} </ul>

This loop loops through a data file called reading

  • and sorts it by the front matter variable date and than filters
  • the collection with reverse in reverse order

*

  • To make it work you first have to assign the data to a new string
  • called sorted.

<ul>

{% assign sorted = (site.data.reading | sort: 'date-read') | reverse %} {% for item in sorted %} <li> By Finished </li> {% endfor %}

</ul>

This take a data file called reading.csv assign it to groups and the groups it by author and pipes it to name and then sorts by name. {% assign groups = site.data.reading | group_by: "author" | sort: "name" %} {% for group in groups %} <h3> </h3>

{% for item in group.items %} <ul> <li></li>

</ul>

{%endfor%} {%endfor%}

{% comment %} This gets data from the reading.csv file and list it by field name (title,author,date-read) {% for reading in site.data.reading %} <ul> <li><src href="_data"></li>
</ul>