diff options
| author | grunfink <grunfink@comam.es> | 2026-04-11 09:30:33 +0200 |
|---|---|---|
| committer | grunfink <grunfink@comam.es> | 2026-04-11 09:30:33 +0200 |
| commit | 4ff0393152111ec5e1a50f2f89caca1a268fb083 (patch) | |
| tree | 0d0599cb04ac4921298e873253cf694f6d5fe8ea | |
| parent | d8eaa95eb2dea542d93a98ce12b3ba36cd639a45 (diff) | |
Also show a location link from people entries, if they have one.
| -rw-r--r-- | html.c | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -3823,6 +3823,30 @@ xs_html *html_people_list(snac *user, xs_list *list, const char *header, const c } } + /* does it have a location? */ + const xs_dict *location = xs_dict_get(actor, "location"); + + if (xs_is_dict(location)) { + const xs_val *latitude = xs_dict_get_def(location, "latitude", xs_stock(0)); + const xs_val *longitude = xs_dict_get_def(location, "longitude", xs_stock(0)); + const char *name = xs_dict_get_def(location, "name", "Home"); + + if (*latitude && *longitude) { + xs *label = xs_fmt("%s,%s", xs_number_str(latitude), xs_number_str(longitude)); + xs *url = xs_fmt("https://openstreetmap.org/search?query=%s,%s", + latitude, longitude); + + xs_html_add(snac_post, + xs_html_tag("p", + xs_html_text(name), + xs_html_text(": "), + xs_html_tag("a", + xs_html_attr("href", url), + xs_html_attr("target", "_blank"), + xs_html_text(label)))); + } + } + /* add user metadata */ xs_html *snac_metadata = xs_html_tag("div", xs_html_attr("class", "snac-metadata")); |