Fix items with no URL in socials
This commit is contained in:
parent
d379475b45
commit
cefb365f66
1 changed files with 10 additions and 3 deletions
|
@ -51,6 +51,14 @@ function firstToUpper(str) {
|
|||
return str.charAt(0).toUpperCase() + str.slice(1)
|
||||
}
|
||||
|
||||
function onlyIfExists(string, check) {
|
||||
if (check) {
|
||||
return string
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
function makeHtmlSafe(str) {
|
||||
return String(str).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
||||
}
|
||||
|
@ -299,9 +307,8 @@ function converter(html, dynamic = true) {
|
|||
for (var x = 0; x < sitesTable.length; x++) {
|
||||
var siteName = sitesTable[x]
|
||||
var siteData = sites[siteName]
|
||||
if (siteData.url) {
|
||||
html += `<a class="chip" href="${siteData.url}">${siteName}: ${siteData.name.replaceAll("Violet", "{Violet}")}</a>`
|
||||
}
|
||||
html += `<a class="chip" ${onlyIfExists(`href="${siteData.url}"`, siteData.url)}>${siteName}: ${siteData.name.replaceAll("Violet", "{Violet}")}</a>`
|
||||
|
||||
}
|
||||
html += "</div></div>"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue