Improving structured data

I've updated the index pages generated by mdsh so that each now includes an ItemList object.

In practice it means, the content listed on the index pages can now be understood better by search engines.

It also increases the likelihood of search engines listing your pages with nice carousels, so mobile users can more easily find more content on your site.

The ItemList objects are added to the <head> of each index page generated, using a new script, .app/itemlist.

Here is the contents of .app/itemlist:

#!/bin/bash

[ ! "$1" ] || [ -z "$1" ] && exit 1

. .site_config

list_items="$1"

# start JSON-ld itemList
echo '<script id="itemlist-ld" type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "ItemList",
  "itemListElement": ['

# set vars used in loop below
i=1;

# for each item in URL, build ListItem
item_count=`echo "$list_items"| wc -l`

for item in $list_items
do
  # print the ListItem
  echo -n '  {
    "@type": "ListItem",
    "position": '$i',
    "url": "https://'${blog_domain}${blog_url}/${item//.mdsh/.html}'"
  }'
  [ $i -le $item_count ] && echo ','
done

# end JSON-ld
echo ']
}</script>'