Table of contents
No headers
/**
Get a list of tags for the current page. Can be filtered by free vs. structured.
*/
var structuredTags = $0 ?? json.parse(site.classifications.configuration) ?? import('MindTouch/Functions/GetStructuredTagsDefinition');
var structuredPrefixes = [];
if (structuredTags) {
foreach (var tagInfo in structuredTags) {
structuredPrefixes ..= [ tagInfo.prefix ];
}
}
var pageTags = page.tags;
var tags = {
free: [],
structured: []
};
if (#pageTags) {
foreach (var tag in map.keys(pageTags)) {
var isStructured = false;
foreach (var prefix in structuredPrefixes) {
if (!isStructured && string.startswith(tag, prefix .. ':')) {
isStructured = true;
break;
}
}
if (isStructured) {
tags.structured ..= [ tag ];
} else {
tags.free ..= [ tag ];
}
}
}
export = tags;
Comments