I strongly recommend you remove the first ۞
and make sure the metadata starts at the very first line of the document. Include the ۞
after the metadata block, if desired. I would also recommend you excise the code removal in the last version of the script I posted.
PS: Get some sleep. Some problems are better to rest on and come back to afresh.
PPS: The result without the content cutting and the change I recommended…
PPPS: The Philosophy/Transcendentalism
tag is created as a set of nested tags. Just so you’re aware.