From b0971ae37c255ea219c07489bc66809caa1094ef Mon Sep 17 00:00:00 2001
From: techknowlogick <techknowlogick@users.noreply.github.com>
Date: Sat, 2 Dec 2017 19:26:06 -0500
Subject: [PATCH] Reduce overhead of upgrades for users with custom
 stylesheets/JS (#3051)

---
 docs/content/doc/advanced/customizing-gitea.en-us.md | 2 ++
 templates/base/footer.tmpl                           | 1 +
 templates/base/head.tmpl                             | 1 +
 templates/custom/footer.tmpl                         | 0
 templates/custom/header.tmpl                         | 0
 5 files changed, 4 insertions(+)
 create mode 100644 templates/custom/footer.tmpl
 create mode 100644 templates/custom/header.tmpl

diff --git a/docs/content/doc/advanced/customizing-gitea.en-us.md b/docs/content/doc/advanced/customizing-gitea.en-us.md
index 4fdf43770a..8c861757ff 100644
--- a/docs/content/doc/advanced/customizing-gitea.en-us.md
+++ b/docs/content/doc/advanced/customizing-gitea.en-us.md
@@ -49,6 +49,8 @@ When you find the correct .tmpl file, you need to copy it in the `custom/templat
 You can now customize the template you copied in `custom/templates`, being carefully to not break the Gitea syntax.
 Any statement contained inside `{{` and `}}` are Gitea templete's syntax and shouldn't be touch, unless you know what are you doing.
 
+To add in custom HTML to the header or the footer of the page, in the `templates/custom` directory there are `header.tmpl` and `footer.tmpl` that can be modified. This is useful if you want to add in custom CSS files, or additional Javascript.
+
 ## Customizing gitignores, labels, licenses, locales, and readmes.
 
 Place your own files in corresponding sub-folder under `custom/options`.
\ No newline at end of file
diff --git a/templates/base/footer.tmpl b/templates/base/footer.tmpl
index e3f6d1319d..ed0dd58b95 100644
--- a/templates/base/footer.tmpl
+++ b/templates/base/footer.tmpl
@@ -66,5 +66,6 @@
 	<!-- JavaScript -->
 	<script src="{{AppSubUrl}}/vendor/plugins/semantic/semantic.min.js"></script>
 	<script src="{{AppSubUrl}}/js/index.js?v={{MD5 AppVer}}"></script>
+{{template "custom/footer" .}}
 </body>
 </html>
diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl
index 46f387a1a7..a7d31d6557 100644
--- a/templates/base/head.tmpl
+++ b/templates/base/head.tmpl
@@ -122,6 +122,7 @@
 	<meta property="og:url" content="{{AppUrl}}" />
 	<meta property="og:description" content="{{MetaDescription}}">
 {{end}}
+{{template "custom/header" .}}
 </head>
 <body>
 	<div class="full height">
diff --git a/templates/custom/footer.tmpl b/templates/custom/footer.tmpl
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/templates/custom/header.tmpl b/templates/custom/header.tmpl
new file mode 100644
index 0000000000..e69de29bb2