update truncate function at index.html