If it's a one-post-only page, show the post content instead of the bio.

This commit is contained in:
default 2024-02-07 19:25:18 +01:00
parent 89b64de531
commit c33fa82755

20
html.c
View file

@ -597,12 +597,21 @@ xs_html *html_user_head(snac *user, char *desc)
/* create a description field */ /* create a description field */
xs *s_desc = NULL; xs *s_desc = NULL;
int n;
if (desc == NULL) if (desc == NULL)
s_desc = xs_dup(xs_dict_get(user->config, "bio")); s_desc = xs_dup(xs_dict_get(user->config, "bio"));
else else
s_desc = xs_dup(desc); s_desc = xs_dup(desc);
/* shorten desc to a reasonable size */
for (n = 0; s_desc[n]; n++) {
if (n > 256 && (s_desc[n] == ' ' || s_desc[n] == '\n'))
break;
}
s_desc[n] = '\0';
/* og properties */ /* og properties */
xs_html_add(head, xs_html_add(head,
xs_html_sctag("meta", xs_html_sctag("meta",
@ -1849,15 +1858,16 @@ xs_str *html_timeline(snac *user, const xs_list *list, int local,
char *v; char *v;
double t = ftime(); double t = ftime();
char *desc = NULL; xs *desc = NULL;
#if 0
if (xs_list_len(list) == 1) { if (xs_list_len(list) == 1) {
/* only one element? pick the description from the source */ /* only one element? pick the description from the source */
xs_dict *d = xs_list_get(list, 0); char *id = xs_list_get(list, 0);
desc = xs_dict_get(d, "sourceContent"); xs *d = NULL;
object_get_by_md5(id, &d);
if (d && (v = xs_dict_get(d, "sourceContent")) != NULL)
desc = xs_dup(v);
} }
#endif
xs_html *head; xs_html *head;
xs_html *body; xs_html *body;