commit ea2eb32

default  ·  2025-01-10 07:12:38 +0000 UTC
parent ed72987
Show the location in the public page.
1 files changed,  +18, -0
M html.c
M html.c
+18, -0
 1@@ -924,6 +924,7 @@ static xs_html *html_user_body(snac *user, int read_only)
 2                             xs_html_raw("✔ "),
 3                             xs_html_tag("a",
 4                                 xs_html_attr("rel", "me"),
 5+                                xs_html_attr("target", "_blank"),
 6                                 xs_html_attr("href", v),
 7                                 xs_html_text(v)));
 8                     }
 9@@ -960,6 +961,23 @@ static xs_html *html_user_body(snac *user, int read_only)
10                 snac_metadata);
11         }
12 
13+        const char *latitude = xs_dict_get_def(user->config, "latitude", "");
14+        const char *longitude = xs_dict_get_def(user->config, "longitude", "");
15+
16+        if (*latitude && *longitude) {
17+            xs *label = xs_fmt(L("%s,%s"), latitude, longitude);
18+            xs *url   = xs_fmt(L("https://openstreetmap.org/search?query=%s,%s"),
19+                        latitude, longitude);
20+
21+            xs_html_add(top_user,
22+                xs_html_tag("p",
23+                    xs_html_text(L("Location: ")),
24+                    xs_html_tag("a",
25+                        xs_html_attr("href", url),
26+                        xs_html_attr("target", "_blank"),
27+                        xs_html_text(label))));
28+        }
29+
30         if (xs_is_true(xs_dict_get(user->config, "show_contact_metrics"))) {
31             xs *fwers = follower_list(user);
32             xs *fwing = following_list(user);