The feature on-chain views was added with the Hangzou protocol. But the TZIP for FA2 standard was defined before Tezos had on-chain views. So in the current state the FA2 Token standard does not support on-chain views, thats the reason why Temple wallet fails to load the metadata (and probably other wallets). Because this is a non standard FA2 implementation. You need to work with either:
A contract can use two methods to provide access to the token-metadata.
- Basic: Store the values in a big-map annotated %token_metadata of type (big_map nat (pair (nat %token_id) (map %token_info string bytes))).
- Custom: Provide a token_metadata off-chain-view which takes as parameter the nat token-id and returns the (pair (nat %token_id) (map %token_info string bytes)) value.
In both cases the “key” is the token-id (of type nat) and one MUST store or return a value of type (pair nat (map string bytes)): the token-id and the metadata defined above.
If both options are present, it is recommended to give precedence to the the off-chain-view (custom).
FA2 - Multi-Asset Interface