summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-09-18 11:49:27 +0200
committerdefault <nobody@localhost>2023-09-18 11:49:27 +0200
commitf556cb5c7dc209414a91d22faecdd1b8696add85 (patch)
treeee726d5a20ba13262f4930cc0c3dc0292145ff3a
parentc4b2d3bc692f39ddca814b104e52939261a0bf6e (diff)
Show metadata in the public HTML page.
-rw-r--r--html.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/html.c b/html.c
index 1dab77f..f967a1e 100644
--- a/html.c
+++ b/html.c
@@ -481,6 +481,32 @@ xs_str *html_user_header(snac *snac, xs_str *s, int local)
xs *s1 = xs_fmt("<div class=\"p-note snac-top-user-bio\">%s</div>\n", bio2);
s = xs_str_cat(s, s1);
+
+ xs_dict *metadata = xs_dict_get(snac->config, "metadata");
+ if (xs_type(metadata) == XSTYPE_DICT) {
+ xs_str *k;
+ xs_str *v;
+
+ s = xs_str_cat(s, "<br><div class=\"snac-metadata\">\n");
+
+ while (xs_dict_iter(&metadata, &k, &v)) {
+ xs *k2 = encode_html(k);
+ xs *v2 = encode_html(v);
+ xs *v3 = NULL;
+
+ if (xs_startswith(v, "https:/" "/"))
+ v3 = xs_fmt("<a href=\"%s\">%s</a>", v2, v2);
+ else
+ v3 = xs_dup(v2);
+
+ xs *s1 = xs_fmt("<span class=\"snac-property-name\">%s</span>:<br>"
+ "<span class=\"snac-property-value\">%s</span><br>\n", k2, v3);
+
+ s = xs_str_cat(s, s1);
+ }
+
+ s = xs_str_cat(s, "</div>\n");
+ }
}
s = xs_str_cat(s, "</div>\n");