]> git.ardis.lu - git.ardis.lu/commitdiff
Improve web view styling
authorArdis Lu <ardisglu@gmail.com>
Thu, 11 Sep 2025 06:08:44 +0000 (23:08 -0700)
committerArdis Lu <ardisglu@gmail.com>
Thu, 11 Sep 2025 06:08:44 +0000 (23:08 -0700)
This set of changes is intended to retain the original "feel" but improve usability. Mainly just making things bigger to better utilize screen space, and horizontal centering.

More opinionated stylistic changes to come later.

etc/gitweb.conf
setup.sh
usr/share/gitweb/static/custom.css [new file with mode: 0644]

index 1e605ea9f0d8e1790624e20ad1a82d85184f9cbe..66e892f56631061de7da653b4ad813c98fd74593 100644 (file)
@@ -1,6 +1,11 @@
 $projectroot = '/srv/git';
 $git_temp = '/tmp';
 
+# https://git-scm.com/docs/gitweb.conf#_links_and_their_targets
+$home_link_str = 'git.ardis.lu';
+push @stylesheets, 'static/custom.css';
+$site_html_head_string = '<meta name="viewport" content="width=device-width, initial-scale=1.0"></meta>';
+
 # https://git-scm.com/docs/gitweb.conf#_changing_gitwebs_look
 $site_name = 'git.ardis.lu';
 $projects_list_description_width = 120; # Increase project description character limit from 25
index c6a277aa4bb15cd18898d11ae272799e28a80c77..379f4026bc6715b63dc1cd70b5b0e37f52568766 100644 (file)
--- a/setup.sh
+++ b/setup.sh
@@ -34,6 +34,16 @@ git config --system safe.directory '*'
 # Otherwise HEAD will point to "master" when using init, even if the pushed repo has renamed main branch
 git config --system init.defaultBranch main
 
+# Better git defaults
+# See https://blog.gitbutler.com/how-git-core-devs-configure-git
+git config --system column.ui auto
+git config --system branch.sort -committerdate
+git config --system tag.sort version:refname
+git config --system diff.algorithm histogram
+git config --system diff.colorMoved plain
+git config --system diff.mnemonicPrefix true
+git config --system diff.renames true
+
 # Setup gitweb
 cp -f ./etc/gitweb.conf /etc
 cp -f ./etc/caddy/Caddyfile /etc/caddy
diff --git a/usr/share/gitweb/static/custom.css b/usr/share/gitweb/static/custom.css
new file mode 100644 (file)
index 0000000..19e1228
--- /dev/null
@@ -0,0 +1,50 @@
+body {
+  font-size: 16px;
+  min-inline-size: min(100% - 22px, 1440px);
+  inline-size: fit-content;
+  margin-inline: auto;
+}
+
+table.project_list,
+table.shortlog,
+table.tags,
+table.heads,
+table.tree,
+table.history,
+table.commit_search,
+table.search {
+  inline-size: 100%;
+}
+
+table.project_list {
+  & th,
+  td {
+    line-height: 2;
+    padding-block: 8px;
+    padding-inline: 4px 16px;
+  }
+}
+
+/* Gitweb replaces all spaces in commit descriptions (log) with &nbsp; which will not wrap by default. */
+div.log,
+div.log_body,
+div.page_body {
+  overflow-wrap: break-word;
+  /* Otherwise body will stretch to fit longest line. */
+  max-inline-size: min(100dvi - 38px, 1440px);
+}
+
+div.log_body {
+  padding: 8px;
+}
+
+td.link,
+td.selflink {
+  font-size: 80%;
+}
+
+td.pre,
+div.pre,
+div.diff {
+  font-size: 14px;
+}
\ No newline at end of file
This page took 0.049574 seconds and 4 git commands to generate.