Based on your description, the issue is likely due to a misconfiguration in your DSpace settings, where the public URL for your instance isn't correctly defined. DSpace is defaulting to localhost for dynamically generated links like those for communities and collections.
Check dspace/config/local.cfg:
Ensure dspace.server.url and dspace.ui.url are set to your public domain, not localhost.
Example: dspace.ui.url = https://your-dspace-domain.edu
Check DSpace 7 Frontend Config:
If you're on DSpace 7, verify the rest configuration in dspace-angular/config/config.prod.yml points to your public host.
Example:
Rebuild and Restart:
After making changes, you'll need to rebuild and/or restart your backend and frontend to apply them.
The items likely show correct URLs because their handles are stored in the database with the proper persistent URL, which is a separate mechanism from how the community/collection links are generated
Humberto