Hi Mark,
you can find the answer to your question here.
The document macros are not resolved for public users from the security reasons. Since you try to access the document collection as a public user, it will return the null value. The public user doesn't have permission to access any documents.
Best regards,
Juraj Komlosi