Fix missing heading in search index.
Fix heading on entities.

Having references before the heading caused the index building script to
fail.
Fix index build errors.

The title has to be the first line in the file for the indexing script
to work.