From ea2eb3299dbb13699cffadb7be445ae87cae00bc Mon Sep 17 00:00:00 2001 From: default Date: Fri, 10 Jan 2025 08:12:38 +0100 Subject: Show the location in the public page. --- html.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/html.c b/html.c index 559d139..eb4ab1f 100644 --- a/html.c +++ b/html.c @@ -924,6 +924,7 @@ static xs_html *html_user_body(snac *user, int read_only) xs_html_raw("✔ "), xs_html_tag("a", xs_html_attr("rel", "me"), + xs_html_attr("target", "_blank"), xs_html_attr("href", v), xs_html_text(v))); } @@ -960,6 +961,23 @@ static xs_html *html_user_body(snac *user, int read_only) snac_metadata); } + const char *latitude = xs_dict_get_def(user->config, "latitude", ""); + const char *longitude = xs_dict_get_def(user->config, "longitude", ""); + + if (*latitude && *longitude) { + xs *label = xs_fmt(L("%s,%s"), latitude, longitude); + xs *url = xs_fmt(L("https://openstreetmap.org/search?query=%s,%s"), + latitude, longitude); + + xs_html_add(top_user, + xs_html_tag("p", + xs_html_text(L("Location: ")), + xs_html_tag("a", + xs_html_attr("href", url), + xs_html_attr("target", "_blank"), + xs_html_text(label)))); + } + if (xs_is_true(xs_dict_get(user->config, "show_contact_metrics"))) { xs *fwers = follower_list(user); xs *fwing = following_list(user); -- cgit v1.2.3