Diff options
Diffstat (limited to 'source')
-rw-r--r--source/cgit.c2
-rw-r--r--source/cmd.c11
-rw-r--r--source/ui-blame.c1
-rw-r--r--source/ui-shared.c10
-rw-r--r--source/ui-shared.h1
-rw-r--r--source/ui-tag.c1
-rw-r--r--source/ui-tree.c1
7 files changed, 24 insertions, 3 deletions
diff --git a/source/cgit.c b/source/cgit.c
index a877e92..efcb703 100644
--- a/source/cgit.c
+++ b/source/cgit.c
@@ -1136,7 +1136,7 @@ static int prepare_repo_cmd(int nongit, int err, int clone)
);
return 1;
}
- ctx.page.title = cgit_fmtalloc("%s - %s", ctx.repo->name, ctx.repo->desc);
+ ctx.page.title = cgit_fmtalloc("%s - %s", ctx.repo->name, ctx.cfg.root_title);
if (!ctx.repo->defbranch)
ctx.repo->defbranch = guess_defbranch();
diff --git a/source/cmd.c b/source/cmd.c
index 8f89e3b..22a6c19 100644
--- a/source/cmd.c
+++ b/source/cmd.c
@@ -43,10 +43,12 @@ static void about_fn(void)
return;
}
if (!ctx.repo) {
+ cgit_prefix_title("about");
cgit_print_site_readme();
return;
}
if (ctx.repo->readme.nr) {
+ cgit_prefix_title("about");
cgit_print_repo_readme();
return;
}
@@ -83,6 +85,7 @@ static void commit_fn(void)
static void diff_fn(void)
{
+ cgit_prefix_title("diff");
cgit_print_diff(ctx.qry.oid, ctx.qry.oid2, ctx.qry.path, 1, 0);
}
@@ -93,6 +96,7 @@ static void info_fn(void)
static void log_fn(void)
{
+ cgit_prefix_title("log");
cgit_print_log(
ctx.qry.oid, ctx.qry.ofs, ctx.cfg.max_commit_count, ctx.qry.grep,
ctx.qry.search, ctx.qry.path, 1, ctx.repo->enable_commit_graph,
@@ -140,6 +144,7 @@ static void rawdiff_fn(void)
static void refs_fn(void)
{
+ cgit_prefix_title("refs");
cgit_print_refs();
}
@@ -155,10 +160,12 @@ static void snapshot_fn(void)
static void stats_fn(void)
{
- if (ctx.repo->max_stats)
+ if (ctx.repo->max_stats) {
+ cgit_prefix_title("stats");
cgit_show_stats();
- else
+ } else {
cgit_print_error_page(404, "Not Found", "Stats are disabled");
+ }
}
static void summary_fn(void)
diff --git a/source/ui-blame.c b/source/ui-blame.c
index f60020c..48cbf8e 100644
--- a/source/ui-blame.c
+++ b/source/ui-blame.c
@@ -298,6 +298,7 @@ static void print_blame_page(const struct object_id *oid, const char *path,
run_blame(&sb, &revs, path, rev);
cgit_set_title_from_path(path);
+ cgit_prefix_title("blame");
cgit_print_layout_start();
htmlf("<div class='blob-header'>blob: %s (", oid_to_hex(oid));
diff --git a/source/ui-shared.c b/source/ui-shared.c
index e7b7d88..8da9878 100644
--- a/source/ui-shared.c
+++ b/source/ui-shared.c
@@ -1991,3 +1991,13 @@ void cgit_set_title_from_path(const char *path)
strbuf_addf(&sb, " - %s", ctx.page.title);
ctx.page.title = strbuf_detach(&sb, NULL);
}
+
+/*
+ * Names the page ahead of the repository and the site, so that the pages of one
+ * repository can be told apart in tabs, history and search results.
+ */
+void cgit_prefix_title(const char *name)
+{
+ ctx.page.title = cgit_fmtalloc("%s - %s", name,
+ ctx.page.title ? ctx.page.title : ctx.cfg.root_title);
+}
diff --git a/source/ui-shared.h b/source/ui-shared.h
index 5a1e5fc..da1b889 100644
--- a/source/ui-shared.h
+++ b/source/ui-shared.h
@@ -141,4 +141,5 @@ extern void cgit_add_hidden_formfields(int incl_head, int incl_search, const cha
* Put path in front of the page title, its last component first.
*/
extern void cgit_set_title_from_path(const char *path);
+extern void cgit_prefix_title(const char *name);
#endif // CGIT_UI_SHARED_H
diff --git a/source/ui-tag.c b/source/ui-tag.c
index 5fa8a17..f9ce6b3 100644
--- a/source/ui-tag.c
+++ b/source/ui-tag.c
@@ -165,6 +165,7 @@ void cgit_print_tag(char *revname)
oid_to_hex(&oid));
goto cleanup;
}
+ cgit_prefix_title(revname);
if (obj->type == OBJ_TAG)
print_annotated_tag(revname, &oid);
else
diff --git a/source/ui-tree.c b/source/ui-tree.c
index 69c0763..95ff337 100644
--- a/source/ui-tree.c
+++ b/source/ui-tree.c
@@ -526,6 +526,7 @@ void cgit_print_tree(const char *rev, char *path)
walk.rev = xstrdup(rev);
if (!path) {
+ cgit_prefix_title("tree");
ls_tree(get_commit_tree_oid(commit), &walk);
goto cleanup;
}