diff options
author | Runxi Yu <me@runxiyu.org> | 2024-07-27 08:00:00 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2024-07-27 08:00:00 +0800 |
commit | 7e04040e3510370d754c4afa94d78da24b43d13e (patch) | |
tree | 6613ec1419aa64cab78ff89d4d026ff7a8e74a23 /templates | |
parent | Some more HTML sanities (diff) | |
download | legitrx-7e04040e3510370d754c4afa94d78da24b43d13e.tar.gz legitrx-7e04040e3510370d754c4afa94d78da24b43d13e.tar.zst legitrx-7e04040e3510370d754c4afa94d78da24b43d13e.zip |
More HTML sanification
Diffstat (limited to 'templates')
-rw-r--r-- | templates/404.html | 6 | ||||
-rw-r--r-- | templates/500.html | 6 | ||||
-rw-r--r-- | templates/commit.html | 5 | ||||
-rw-r--r-- | templates/file.html | 5 | ||||
-rw-r--r-- | templates/head.html | 37 | ||||
-rw-r--r-- | templates/index.html | 5 | ||||
-rw-r--r-- | templates/log.html | 5 | ||||
-rw-r--r-- | templates/refs.html | 5 | ||||
-rw-r--r-- | templates/repo-header.html | 2 | ||||
-rw-r--r-- | templates/repo.html | 5 | ||||
-rw-r--r-- | templates/tree.html | 11 |
11 files changed, 51 insertions, 41 deletions
diff --git a/templates/404.html b/templates/404.html index 3a68101..382ee25 100644 --- a/templates/404.html +++ b/templates/404.html @@ -1,8 +1,10 @@ {{ define "404" }} <!DOCTYPE html> <html> - <title>404 Not Found</title> - {{ template "head" . }} + <head> + {{ template "generichead" . }} + <title>404 Not Found</title> + </head> <body> {{ template "nav" . }} <main> diff --git a/templates/500.html b/templates/500.html index 77bb9ab..9c55dd1 100644 --- a/templates/500.html +++ b/templates/500.html @@ -1,8 +1,10 @@ {{ define "500" }} <!DOCTYPE html> <html> - <title>500 Internal Server Error</title> - {{ template "head" . }} + <head> + {{ template "generichead" . }} + <title>500 Internal Server Error</title> + </head> <body> {{ template "nav" . }} <main> diff --git a/templates/commit.html b/templates/commit.html index c556fa8..665e9f9 100644 --- a/templates/commit.html +++ b/templates/commit.html @@ -1,7 +1,10 @@ {{ define "commit" }} <!DOCTYPE html> <html> - {{ template "head" . }} + <head> + {{ template "generichead" . }} + <title>{{ .meta.Title }} — {{ .name }}: {{ .commit.This }}</title> + </head> <body> {{ template "repoheader" . }} {{ template "nav" . }} diff --git a/templates/file.html b/templates/file.html index 7dd5b86..de837a5 100644 --- a/templates/file.html +++ b/templates/file.html @@ -1,7 +1,10 @@ {{ define "file" }} <!DOCTYPE html> <html> - {{ template "head" . }} + <head> + {{ template "generichead" . }} + <title>{{ .meta.Title }} — {{ .name }} ({{ .ref }}): {{ .path }}</title> + </head> <body> {{ template "repoheader" . }} {{ template "nav" . }} diff --git a/templates/head.html b/templates/head.html index f2a3bda..ec53412 100644 --- a/templates/head.html +++ b/templates/head.html @@ -1,30 +1,9 @@ -{{ define "head" }} -<head> - <meta charset="utf-8" /> - <meta name="viewport" content="width=device-width, initial-scale=1" /> - <link rel="stylesheet" href="/static/style.css" type="text/css" /> - <link rel="icon" type="image/png" size="32x32" href="/static/legit.png" /> - {{ if .parent }} - <title>{{ .meta.Title }} — {{ .name }} ({{ .ref }}): {{ .parent }}/</title> - {{ else if .path }} - <title>{{ .meta.Title }} — {{ .name }} ({{ .ref }}): {{ .path }}</title> - {{ else if .files }} - <title>{{ .meta.Title }} — {{ .name }} ({{ .ref }})</title> - {{ else if .commit }} - <title>{{ .meta.Title }} — {{ .name }}: {{ .commit.This }}</title> - {{ else if .branches }} - <title>{{ .meta.Title }} — {{ .name }}: refs</title> - {{ else if .commits }} - {{ if .log }} - <title>{{ .meta.Title }} — {{ .name }}: log</title> - {{ else }} - <title>{{ .meta.Title }} — {{ .name }}</title> - {{ end }} - {{ else }} - <title>{{ .meta.Title }}</title> - {{ end }} - {{ if and .servername .gomod }} - <meta name="go-import" content="{{ .servername}}/{{ .name }} git https://{{ .servername }}/{{ .name }}"> - {{ end }} -</head> +{{ define "generichead" }} +<meta charset="utf-8" /> +<meta name="viewport" content="width=device-width, initial-scale=1" /> +<link rel="stylesheet" href="/static/style.css" type="text/css" /> +<link rel="icon" type="image/png" size="32x32" href="/static/legit.png" /> +{{ if and .servername .gomod }} + <meta name="go-import" content="{{ .servername}}/{{ .name }} git https://{{ .servername }}/{{ .name }}"> +{{ end }} {{ end }} diff --git a/templates/index.html b/templates/index.html index f803942..93ac64b 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,7 +1,10 @@ {{ define "index" }} <!DOCTYPE html> <html> -{{ template "head" . }} + <head> + {{ template "generichead" . }} + <title>{{ .meta.Title }}</title> + </head> <body> <header> <h1>{{ .meta.Title }}</h1> diff --git a/templates/log.html b/templates/log.html index f4d15c7..5a52a3b 100644 --- a/templates/log.html +++ b/templates/log.html @@ -1,7 +1,10 @@ {{ define "log" }} <!DOCTYPE html> <html> - {{ template "head" . }} + <head> + {{ template "generichead" . }} + <title>{{ .meta.Title }} — {{ .name }}: log</title> + </head> <body> {{ template "repoheader" . }} {{ template "nav" . }} diff --git a/templates/refs.html b/templates/refs.html index 0138791..e6620c6 100644 --- a/templates/refs.html +++ b/templates/refs.html @@ -1,7 +1,10 @@ {{ define "refs" }} <!DOCTYPE html> <html> - {{ template "head" . }} + <head> + {{ template "generichead" . }} + <title>{{ .meta.Title }} — {{ .name }}: refs</title> + </head> <body> {{ template "repoheader" . }} {{ template "nav" . }} diff --git a/templates/repo-header.html b/templates/repo-header.html index 7be2d65..e816ed3 100644 --- a/templates/repo-header.html +++ b/templates/repo-header.html @@ -3,7 +3,7 @@ <h2> <a href="/">all repos</a> — {{ .displayname }} {{ if .ref }} - <span class="ref">@ {{ .ref }}</span> + <span class="ref">{{ .ref }}</span> {{ end }} </h2> <h3 class="desc">{{ .desc }}</h3> diff --git a/templates/repo.html b/templates/repo.html index 6bcc294..97dc8b0 100644 --- a/templates/repo.html +++ b/templates/repo.html @@ -1,7 +1,10 @@ {{ define "repo" }} <!DOCTYPE html> <html> - {{ template "head" . }} + <head> + {{ template "generichead" . }} + <title>{{ .meta.Title }} — {{ .name }}</title> + </head> <body> {{ template "repoheader" . }} {{ template "nav" . }} diff --git a/templates/tree.html b/templates/tree.html index 6634a5c..939767a 100644 --- a/templates/tree.html +++ b/templates/tree.html @@ -1,7 +1,16 @@ {{ define "tree" }} <!DOCTYPE html> <html> - {{ template "head" . }} + <head> + {{ template "generichead" . }} + {{ if .parent }} + <title>{{ .meta.Title }} — {{ .name }} ({{ .ref }}): {{ .parent }}/</title> + {{ else if .files }} + <title>{{ .meta.Title }} — {{ .name }} ({{ .ref }})</title> + {{ else }} + <title>{{ .meta.Title }} — {{ .name }} ({{ .ref }}): BROKEN???</title> + {{ end }} + </head> <body> {{ template "repoheader" . }} {{ template "nav" . }} |