the repository which powers this website
Allow customising path to themed.css
| -rw-r--r-- | cgit.c | 2 | ||||
| -rw-r--r-- | cgit.h | 1 | ||||
| -rw-r--r-- | themed/base.html | 6 | ||||
| -rw-r--r-- | ui-shared.c | 5 | ||||
| -rw-r--r-- | ui-shared.h | 1 |
5 files changed, 14 insertions, 1 deletions
@@ -145,6 +145,8 @@ static void config_cb(const char *name, const char *value) ctx.cfg.root_readme = xstrdup(value); else if (!strcmp(name, "css")) string_list_append(&ctx.cfg.css, xstrdup(value)); + else if (!strcmp(name, "css-themed")) + string_list_append(&ctx.cfg.css_themed, xstrdup(value)); else if (!strcmp(name, "js")) string_list_append(&ctx.cfg.js, xstrdup(value)); else if (!strcmp(name, "favicon")) @@ -211,6 +211,7 @@ struct cgit_config { char *project_list; struct string_list readme; struct string_list css; + struct string_list css_themed; char *robots; char *root_title; char *root_desc; diff --git a/themed/base.html b/themed/base.html index 1f52b127..f7b91438 100644 --- a/themed/base.html +++ b/themed/base.html @@ -7,7 +7,11 @@ <meta charset="utf-8"> <title>{{ ctx.page.title }}</title>{# ctx.page.title is usually set by prepare_repo_cmd #} <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap"> - <link rel="stylesheet" href="/themed.css"> + {% if ctx.cfg.css_themed.items %} + {! for_each_string_list(&ctx.cfg.css_themed, cgit_shared_emit_css_link, NULL); !} + {% else %} + {! cgit_shared_emit_css_link(NULL, "/themed.css"); !} + {% endif %} </head> <body class="text-gray-900"> {% endblock %} diff --git a/ui-shared.c b/ui-shared.c index 5e4d83ed..9c846b6c 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -847,6 +847,11 @@ static int emit_css_link(struct string_list_item *s, void *arg) return 0; } +int cgit_shared_emit_css_link(struct string_list_item *s, void *arg) +{ + return emit_css_link(s, arg); +} + static int emit_js_link(struct string_list_item *s, void *arg) { /* Do not emit anything if js= is specified. */ diff --git a/ui-shared.h b/ui-shared.h index 47fcced4..62db46a9 100644 --- a/ui-shared.h +++ b/ui-shared.h @@ -1,6 +1,7 @@ #ifndef UI_SHARED_H #define UI_SHARED_H +extern int cgit_shared_emit_css_link(struct string_list_item *s, void *arg); extern const char *cgit_shared_repolink_url(const char *page, const char *head, const char *path); extern void cgit_shared_repolink_url_with_delimiter(const char *page, const char *head, const char *path); extern void cgit_shared_reporevlink_url(const char *page, const char *head, const char *rev, const char *path); |