Matrix Version: 5.5
Hello, can anyone help me here as I’m a tad confused as to why I’m getting a value of 1 when there’s no metadata.
example metadata code values: XYZ-1234, ABC-567 etc
runat server:
let array2 = %asset_metadata_myMetadata^explode:, %
print(array2.length)
If there’s no metadata added to the page I still get “1” printed - if I have one metadata value I still get “1”.
Should it be 0 for empty and 1 if there’s a value ie; true/false?
Basically what I’m trying to acheive is if there’s metadata and array2 is greater than 0 then print codeTemplate else don’t.
const codeTemplate =`
<div class="pc-container">
<h3>Research codes</h3>
<ul class="research-code-container">
.
.
.
</ul>
</div>
if(array2.length > 0) {
print(codeTemplate);
}`
What am I missing??