commit - ceba53a60fdfdb73913897fa179ac191312efaf9
commit + 3a808745bd7fe837adb606174d77d0891e3966dd
blob - 345dabf5fe01de8381a5218722481f97d1ba4a64
blob + 0a15e33f2954fcf9b6d0bb279c0b0599a680d3bf
--- fragments.tmpl
+++ fragments.tmpl
{{ define tp_navigation(struct template *tp) }}
{!
struct client *clt = tp->tp_arg;
- const char *prfx = clt->clt_script_name;
+ const char *dname, *dsufx = "/", *prfx = clt->clt_script_name;
char *path = clt->clt_path_info;
char *tilde, *t, home[GEMINI_MAXLEN], up[GEMINI_MAXLEN];
- char *dname;
+ char usr[64];
char c;
*home = '\0';
*t = '\0';
(void) strlcpy(home, path + 1, sizeof(home));
*t = c;
+
+ c = *--t;
+ *t = '\0';
+ (void) strlcpy(usr, tilde + 2, sizeof(usr));
+ *t = c;
}
(void) strlcpy(up, path + 1, sizeof(up));
dname = dirname(up);
+ if (!strcmp(dname, ".")) {
+ dname = "";
+ dsufx = "";
+ }
!}
<header>
<nav>
<ul>
<li><a href="{{ prfx }}">/ Root</a></li>
+ <li><a href="{{ prfx }}{{ dname }}{{ dsufx }}">
+ ↑ Up
+ </a></li>
+
{{ if *home != '\0' }}
- <li><a href="{{ prfx }}{{ home }}">🏠 Home</a></li>
+ <li><a href="{{ prfx }}{{ home }}">
+ 🏠 {{usr}}' home
+ </a></li>
{{ end }}
-
- {{ if strcmp(dname, ".") != 0 }}
- <li><a href="{{ prfx }}{{ dname }}/">↑ Up</a></li>
- {{ end }}
</ul>
</nav>
</header>