From 32d164f08b3312858c39893254769e4859fe5a86 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Mon, 10 Feb 2025 19:25:44 +0800 Subject: [PATCH] head.html: Add a common head template I tried to define a base.html and extend it from there, but Go's templating system doesn't support that. --- templates/base.html | 26 -------------------------- templates/category_index.html | 2 +- templates/head.html | 5 +++++ templates/index.html | 2 +- templates/repo_index.html | 2 +- templates/repo_tree_dir.html | 2 +- templates/repo_tree_file.html | 2 +- diff --git a/templates/base.html b/templates/base.html deleted file mode 100644 index 67bc7b61d7803b0160d03d4c34999cedfa675c9d..0000000000000000000000000000000000000000 --- a/templates/base.html +++ /dev/null @@ -1,26 +0,0 @@ -{{- define "base" -}} - - - - - - - {{ block "title" . }}Lindenii Forge{{ end }} - - -
- - {{ block "forge-title" . }} - Lindenii Forge - {{ end }} - - - -
-
- {{ block "main" . }} - {{ end }} -
- - -{{- end -}} diff --git a/templates/category_index.html b/templates/category_index.html index cd5e95c6d2d70edccc8dd53b039b87daf4297f0c..6ee729e9f32d60178d4d8a7543b90853e70b8948 100644 --- a/templates/category_index.html +++ b/templates/category_index.html @@ -2,7 +2,7 @@ {{- define "category_index" -}} - + {{ template "head_common" . }} {{ .category_name }} diff --git a/templates/head.html b/templates/head.html new file mode 100644 index 0000000000000000000000000000000000000000..b2cd48718a770fa736bd7d2d9024b9a9c250ea21 --- /dev/null +++ b/templates/head.html @@ -0,0 +1,5 @@ +{{- define "head_common" -}} + + + +{{- end -}} diff --git a/templates/index.html b/templates/index.html index be02d7cd97436f668cdc01294a48cfc04e397825..cbf701204cbe556c3bb20ae15c315970329a8f01 100644 --- a/templates/index.html +++ b/templates/index.html @@ -2,7 +2,7 @@ {{- define "index" -}} - + {{ template "head_common" . }} Forge diff --git a/templates/repo_index.html b/templates/repo_index.html index aa708c45602b02a87be5bdf4c3be76628356593c..fc2ac518b38d4fcf517f81902515d95b0d44aa5a 100644 --- a/templates/repo_index.html +++ b/templates/repo_index.html @@ -2,7 +2,7 @@ {{- define "repo_index" -}} - + {{ template "head_common" . }} {{ .category_name }}/repos/{{ .repo_name }} diff --git a/templates/repo_tree_dir.html b/templates/repo_tree_dir.html index ffdb64d2492d03b122569ec157bbb2339c5dbe15..609d17ebadbdb6e47eceb4aa2d6b557b592ace27 100644 --- a/templates/repo_tree_dir.html +++ b/templates/repo_tree_dir.html @@ -2,7 +2,7 @@ {{- define "repo_tree_dir" -}} - + {{ template "head_common" . }} {{ .category_name }}/repos/{{ .repo_name }}/{{ .path_spec }} diff --git a/templates/repo_tree_file.html b/templates/repo_tree_file.html index 9874cdedb356604da879b2537e88db049a97f3f2..cd511080ebf4251c9f4f01222d2fcc54afa11550 100644 --- a/templates/repo_tree_file.html +++ b/templates/repo_tree_file.html @@ -2,7 +2,7 @@ {{- define "repo_tree_file" -}} - + {{ template "head_common" . }} {{ .category_name }}/repos/{{ .repo_name }}/{{ .path_spec }} -- 2.48.1