my-gitea-templates/templates/base/ head.tmpl
177 lines
7.3 KiB

  1. <!DOCTYPE html>
  2. <html lang="{{.Language}}">
  3. <head data-suburl="{{AppSubUrl}}">
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <meta http-equiv="x-ua-compatible" content="ie=edge">
  7. <title>{{if .Repository.Name}}{{.Repository.Name}}{{else}}{{if .Title}}{{.Title}} — {{end}}{{AppName}}{{end}}</title>
  8. <link rel="manifest" href="{{AppSubUrl}}/manifest.json" crossorigin="use-credentials">
  9. {{if UseServiceWorker}}
  10. <script>
  11. if ('serviceWorker' in navigator) {
  12. navigator.serviceWorker.register('{{AppSubUrl}}/serviceworker.js').then(function(registration) {
  13. // Registration was successful
  14. console.info('ServiceWorker registration successful with scope: ', registration.scope);
  15. }, function(err) {
  16. // registration failed :(
  17. console.info('ServiceWorker registration failed: ', err);
  18. });
  19. }
  20. </script>
  21. {{else}}
  22. <script>
  23. if ('serviceWorker' in navigator) {
  24. navigator.serviceWorker.getRegistrations().then(function(registrations) {
  25. registrations.forEach(function(registration) {
  26. registration.unregister();
  27. console.info('ServiceWorker unregistered');
  28. });
  29. });
  30. }
  31. </script>
  32. {{end}}
  33. <meta name="theme-color" content="{{ThemeColorMetaTag}}">
  34. <meta name="author" content="{{if .Repository}}{{.Owner.Name}}{{else}}{{end}}" />
  35. <meta name="description" content="{{if .Repository}}{{.Repository.Name}}{{if .Repository.Description}} - {{.Repository.Description}}{{end}}{{else}}{{end}}" />
  36. <meta name="referrer" content="no-referrer" />
  37. <meta name="_csrf" content="{{.CsrfToken}}" />
  38. {{if .IsSigned}}
  39. <meta name="_uid" content="{{.SignedUser.ID}}" />
  40. {{end}}
  41. {{if .ContextUser}}
  42. <meta name="_context_uid" content="{{.ContextUser.ID}}" />
  43. {{end}}
  44. {{if .SearchLimit}}
  45. <meta name="_search_limit" content="{{.SearchLimit}}" />
  46. {{end}}
  47. {{if .GoGetImport}}
  48. <meta name="go-import" content="{{.GoGetImport}} git {{.CloneLink.HTTPS}}">
  49. <meta name="go-source" content="{{.GoGetImport}} _ {{.GoDocDirectory}} {{.GoDocFile}}">
  50. {{end}}
  51. <script>
  52. {{SafeJS `/*
  53. @licstart The following is the entire license notice for the
  54. JavaScript code in this page.
  55. Copyright (c) 2016 The Gitea Authors
  56. Copyright (c) 2015 The Gogs Authors
  57. Permission is hereby granted, free of charge, to any person obtaining a copy
  58. of this software and associated documentation files (the "Software"), to deal
  59. in the Software without restriction, including without limitation the rights
  60. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  61. copies of the Software, and to permit persons to whom the Software is
  62. furnished to do so, subject to the following conditions:
  63. The above copyright notice and this permission notice shall be included in
  64. all copies or substantial portions of the Software.
  65. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  66. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  67. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  68. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  69. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  70. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  71. THE SOFTWARE.
  72. ---
  73. Licensing information for additional javascript libraries can be found at:
  74. {{StaticUrlPrefix}}/vendor/librejs.html
  75. @licend The above is the entire license notice
  76. for the JavaScript code in this page.
  77. */`}}
  78. </script>
  79. <script>
  80. window.config = {
  81. AppSubUrl: '{{AppSubUrl}}',
  82. StaticUrlPrefix: '{{StaticUrlPrefix}}',
  83. csrf: '{{.CsrfToken}}',
  84. HighlightJS: {{if .RequireHighlightJS}}true{{else}}false{{end}},
  85. Minicolors: {{if .RequireMinicolors}}true{{else}}false{{end}},
  86. SimpleMDE: {{if .RequireSimpleMDE}}true{{else}}false{{end}},
  87. Tribute: {{if .RequireTribute}}true{{else}}false{{end}},
  88. U2F: {{if .RequireU2F}}true{{else}}false{{end}},
  89. Heatmap: {{if .EnableHeatmap}}true{{else}}false{{end}},
  90. heatmapUser: {{if .HeatmapUser}}'{{.HeatmapUser}}'{{else}}null{{end}},
  91. };
  92. </script>
  93. <link rel="shortcut icon" href="{{StaticUrlPrefix}}/img/favicon.png" />
  94. <link rel="mask-icon" href="{{StaticUrlPrefix}}/img/gitea-safari.svg" color="#609926">
  95. <link rel="fluid-icon" href="{{StaticUrlPrefix}}/img/gitea-lg.png" title="{{AppName}}">
  96. <link rel="stylesheet" href="{{StaticUrlPrefix}}/vendor/assets/font-awesome/css/font-awesome.min.css">
  97. <link rel="preload" as="font" href="{{StaticUrlPrefix}}/fomantic/themes/default/assets/fonts/icons.woff2" type="font/woff2" crossorigin="anonymous">
  98. <link rel="preload" as="font" href="{{StaticUrlPrefix}}/fomantic/themes/default/assets/fonts/outline-icons.woff2" type="font/woff2" crossorigin="anonymous">
  99. {{if .RequireSimpleMDE}}
  100. <link rel="stylesheet" href="{{AppSubUrl}}/vendor/plugins/simplemde/simplemde.min.css">
  101. {{end}}
  102. {{if .RequireTribute}}
  103. <link rel="stylesheet" href="{{StaticUrlPrefix}}/vendor/plugins/tribute/tribute.css">
  104. {{end}}
  105. <link rel="stylesheet" href="{{StaticUrlPrefix}}/fomantic/semantic.min.css?v={{MD5 AppVer}}">
  106. <link rel="stylesheet" href="{{StaticUrlPrefix}}/css/index.css?v={{MD5 AppVer}}">
  107. <link rel="stylesheet" href="/custom-style.css">
  108. <noscript>
  109. <style>
  110. .dropdown:hover > .menu { display: block; }
  111. .ui.secondary.menu .dropdown.item > .menu { margin-top: 0; }
  112. </style>
  113. </noscript>
  114. {{if .RequireMinicolors}}
  115. <link rel="stylesheet" href="{{StaticUrlPrefix}}/vendor/plugins/jquery.minicolors/jquery.minicolors.css">
  116. {{end}}
  117. <style class="list-search-style"></style>
  118. {{if .PageIsUserProfile}}
  119. <meta property="og:title" content="{{.Owner.Name}}" />
  120. <meta property="og:type" content="profile" />
  121. <meta property="og:image" content="{{.Owner.AvatarLink}}" />
  122. <meta property="og:url" content="{{.Owner.HTMLURL}}" />
  123. {{if .Owner.Description}}
  124. <meta property="og:description" content="{{.Owner.Description}}">
  125. {{end}}
  126. {{else if .Repository}}
  127. {{if .Issue}}
  128. <meta property="og:title" content="{{.Issue.Title}}" />
  129. <meta property="og:url" content="{{.Issue.HTMLURL}}" />
  130. {{if .Issue.Content}}
  131. <meta property="og:description" content="{{.Issue.Content}}" />
  132. {{end}}
  133. {{else}}
  134. <meta property="og:title" content="{{.Repository.Name}}" />
  135. <meta property="og:url" content="{{.Repository.HTMLURL}}" />
  136. {{if .Repository.Description}}
  137. <meta property="og:description" content="{{.Repository.Description}}" />
  138. {{end}}
  139. {{end}}
  140. <meta property="og:type" content="object" />
  141. <meta property="og:image" content="{{.Repository.Owner.AvatarLink}}" />
  142. {{else}}
  143. <meta property="og:title" content="{{AppName}}">
  144. <meta property="og:type" content="website" />
  145. <meta property="og:image" content="{{StaticUrlPrefix}}/img/gitea-lg.png" />
  146. <meta property="og:url" content="{{AppUrl}}" />
  147. <meta property="og:description" content="{{MetaDescription}}">
  148. {{end}}
  149. <meta property="og:site_name" content="{{AppName}}" />
  150. {{if .IsSigned }}
  151. {{ if ne .SignedUser.Theme "gitea" }}
  152. <link rel="stylesheet" href="{{StaticUrlPrefix}}/css/theme-{{.SignedUser.Theme}}.css?v={{MD5 AppVer}}">
  153. {{end}}
  154. {{else if ne DefaultTheme "gitea"}}
  155. <link rel="stylesheet" href="{{StaticUrlPrefix}}/css/theme-{{DefaultTheme}}.css?v={{MD5 AppVer}}">
  156. {{end}}
  157. {{template "custom/header" .}}
  158. </head>
  159. <body>
  160. {{template "custom/body_outer_pre" .}}
  161. <div class="full height">
  162. {{template "custom/body_inner_pre" .}}
  163. {{/*
  164. </div>
  165. </body>
  166. </html>
  167. */}}