The getMetadata()
JavaScript method provides the metadata of the currently open topic. It is only available in the Topic template designer.
Example
The following example prints the metadata of the currently open topic in the user's browser console.
async function getTopicMetadata() {
try {
const metadata = await topic.getMetadata();
console.log(JSON.stringify(metadata, null, 2));
} catch (error) {
console.error("Error while fetching metadata:", error);
return null;
}
}
// Call the function to get the topic metadata
getTopicMetadata();