commit 89b64de
default
·
2024-02-07 18:15:20 +0000 UTC
parent 80c31a2
Some og:description tweaks.
1 files changed,
+21,
-11
M
html.c
M
html.c
+21,
-11
1@@ -552,7 +552,7 @@ static xs_html *html_instance_body(char *tag)
2 }
3
4
5-xs_html *html_user_head(snac *user)
6+xs_html *html_user_head(snac *user, char *desc)
7 {
8 xs_html *head = html_base_head();
9
10@@ -595,13 +595,13 @@ xs_html *html_user_head(snac *user)
11 avatar = xs_fmt("%s/susie.png", srv_baseurl);
12 }
13
14- xs *s_bio = xs_dup(xs_dict_get(user->config, "bio"));
15- int n;
16+ /* create a description field */
17+ xs *s_desc = NULL;
18
19- /* shorten the bio */
20- for (n = 0; s_bio[n] && s_bio[n] != '&' && s_bio[n] != '.' &&
21- s_bio[n] != '\r' && s_bio[n] != '\n' && n < 128; n++);
22- s_bio[n] = '\0';
23+ if (desc == NULL)
24+ s_desc = xs_dup(xs_dict_get(user->config, "bio"));
25+ else
26+ s_desc = xs_dup(desc);
27
28 /* og properties */
29 xs_html_add(head,
30@@ -613,7 +613,7 @@ xs_html *html_user_head(snac *user)
31 xs_html_attr("content", title)),
32 xs_html_sctag("meta",
33 xs_html_attr("property", "og:description"),
34- xs_html_attr("content", s_bio)),
35+ xs_html_attr("content", s_desc)),
36 xs_html_sctag("meta",
37 xs_html_attr("property", "og:image"),
38 xs_html_attr("content", avatar)),
39@@ -1849,11 +1849,21 @@ xs_str *html_timeline(snac *user, const xs_list *list, int local,
40 char *v;
41 double t = ftime();
42
43+ char *desc = NULL;
44+
45+#if 0
46+ if (xs_list_len(list) == 1) {
47+ /* only one element? pick the description from the source */
48+ xs_dict *d = xs_list_get(list, 0);
49+ desc = xs_dict_get(d, "sourceContent");
50+ }
51+#endif
52+
53 xs_html *head;
54 xs_html *body;
55
56 if (user) {
57- head = html_user_head(user);
58+ head = html_user_head(user, desc);
59 body = html_user_body(user, local);
60 }
61 else {
62@@ -2125,7 +2135,7 @@ xs_str *html_people(snac *user)
63 xs *wers = follower_list(user);
64
65 xs_html *html = xs_html_tag("html",
66- html_user_head(user),
67+ html_user_head(user, NULL),
68 xs_html_add(html_user_body(user, 0),
69 html_people_list(user, wing, L("People you follow"), "i"),
70 html_people_list(user, wers, L("People that follow you"), "e"),
71@@ -2143,7 +2153,7 @@ xs_str *html_notifications(snac *user, int skip, int show)
72 xs_html *body = html_user_body(user, 0);
73
74 xs_html *html = xs_html_tag("html",
75- html_user_head(user),
76+ html_user_head(user, NULL),
77 body);
78
79 xs *clear_all_action = xs_fmt("%s/admin/clear-notifications", user->actor);