Public
Back
Version 13
5/22/2024
function getHREF(mod) {
const url = new URL(mod);
return `https://val.town${url.pathname}`;
}
export interface BadgeOptions {
width?: number;
}
export default function GetBadgeHTML(url: URL, opts: BadgeOptions = {}): string {
const href = getHREF(url);
const {
width = 160,
} = opts;
const height = 160 * 0.3;
return `
<a href="${href}" target="_blank">
<img src="https://jxnblk-valtownbadgesvg.web.val.run/" width="${width}" height="${height}">
</a>
`;
}
Updated: May 24, 2024