diff options
| author | 2024-02-07 19:25:18 +0100 | |
|---|---|---|
| committer | 2024-02-07 19:25:18 +0100 | |
| commit | c33fa82755c0f5c225f3dee3c16a3b16b288bb88 (patch) | |
| tree | efcbcfb827946b8bffd47906c99f10b971233771 /html.c | |
| parent | Some og:description tweaks. (diff) | |
| download | snac2-c33fa82755c0f5c225f3dee3c16a3b16b288bb88.tar.gz snac2-c33fa82755c0f5c225f3dee3c16a3b16b288bb88.tar.xz snac2-c33fa82755c0f5c225f3dee3c16a3b16b288bb88.zip | |
If it's a one-post-only page, show the post content instead of the bio.
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 20 |
1 files changed, 15 insertions, 5 deletions
| @@ -597,12 +597,21 @@ xs_html *html_user_head(snac *user, char *desc) | |||
| 597 | 597 | ||
| 598 | /* create a description field */ | 598 | /* create a description field */ |
| 599 | xs *s_desc = NULL; | 599 | xs *s_desc = NULL; |
| 600 | int n; | ||
| 600 | 601 | ||
| 601 | if (desc == NULL) | 602 | if (desc == NULL) |
| 602 | s_desc = xs_dup(xs_dict_get(user->config, "bio")); | 603 | s_desc = xs_dup(xs_dict_get(user->config, "bio")); |
| 603 | else | 604 | else |
| 604 | s_desc = xs_dup(desc); | 605 | s_desc = xs_dup(desc); |
| 605 | 606 | ||
| 607 | /* shorten desc to a reasonable size */ | ||
| 608 | for (n = 0; s_desc[n]; n++) { | ||
| 609 | if (n > 256 && (s_desc[n] == ' ' || s_desc[n] == '\n')) | ||
| 610 | break; | ||
| 611 | } | ||
| 612 | |||
| 613 | s_desc[n] = '\0'; | ||
| 614 | |||
| 606 | /* og properties */ | 615 | /* og properties */ |
| 607 | xs_html_add(head, | 616 | xs_html_add(head, |
| 608 | xs_html_sctag("meta", | 617 | xs_html_sctag("meta", |
| @@ -1849,15 +1858,16 @@ xs_str *html_timeline(snac *user, const xs_list *list, int local, | |||
| 1849 | char *v; | 1858 | char *v; |
| 1850 | double t = ftime(); | 1859 | double t = ftime(); |
| 1851 | 1860 | ||
| 1852 | char *desc = NULL; | 1861 | xs *desc = NULL; |
| 1853 | 1862 | ||
| 1854 | #if 0 | ||
| 1855 | if (xs_list_len(list) == 1) { | 1863 | if (xs_list_len(list) == 1) { |
| 1856 | /* only one element? pick the description from the source */ | 1864 | /* only one element? pick the description from the source */ |
| 1857 | xs_dict *d = xs_list_get(list, 0); | 1865 | char *id = xs_list_get(list, 0); |
| 1858 | desc = xs_dict_get(d, "sourceContent"); | 1866 | xs *d = NULL; |
| 1867 | object_get_by_md5(id, &d); | ||
| 1868 | if (d && (v = xs_dict_get(d, "sourceContent")) != NULL) | ||
| 1869 | desc = xs_dup(v); | ||
| 1859 | } | 1870 | } |
| 1860 | #endif | ||
| 1861 | 1871 | ||
| 1862 | xs_html *head; | 1872 | xs_html *head; |
| 1863 | xs_html *body; | 1873 | xs_html *body; |