Make docspage inherit from base.html
authorMagnus Hagander <magnus@hagander.net>
Wed, 3 Sep 2025 12:26:51 +0000 (14:26 +0200)
committerMagnus Hagander <magnus@hagander.net>
Wed, 3 Sep 2025 12:26:51 +0000 (14:26 +0200)
There was 99+% overlap between these, leading to some details missed
between them. The fact that the whole base is reproduced inside
docspage.html is probably legacy from a long time ago. So
instead make docspage.html inherit from base and set the required parametrs.

The only output difference in this is that the rel=canonical link moves
to a different part in the <head>, but it's still in <head>.

As a bonus, this also fixes the gitrev tag for theme.js, that commit 97942bcab
only fixed for base and not docs, and it fixes the footer link to
policies that e7099c90e only updated for base and not docs.

templates/docs/docspage.html

index 1dd765325ffa915de36d5f640fa8087d1dd90bc5..f19cb0c738b99ad08dd71d4d8b476b3f5144e851 100644 (file)
@@ -1,82 +1,15 @@
-<!doctype html>
-<html lang="en">
- <head>
-  <title>PostgreSQL: Documentation: {{page.display_version}}: {{page.title}}</title>
-  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
-  <meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8" />
-  {%block meta%}{%endblock%} {# used for custom meta tags such as description which we don't want for every page #}
-  <meta name="theme-color" content="#336791"/>
-  <meta name="copyright" content="The PostgreSQL Global Development Group" />{%if og%}
-  <meta property="og:url" content="https://www.postgresql.org{{og.url}}" />
-  <meta property="og:type" content="article" />
-  <meta property="article:published_time" content="{{og.time|date:"c"}}" />
-{%if not og.noimage%}  <meta property="og:image" content="https://www.postgresql.org/media/img/about/press/elephant.png" />{%endif%}
-  <meta property="og:title" content="{{og.title}}" />
-{%if og.description%}  <meta property="og:description" content="{{og.description|truncatewords:"20"}}" />{%endif%}
-  <meta property="og:site_name" content="{{og.sitename|default:"PostgreSQL"}}" />{%endif%}
+{% extends "base/base.html" %}
+
+{% block title %}Documentation: {{page.display_version}}: {{page.title}}{% endblock %}
+
+{% block extrahead %}
 {%if not page.version.supported%}  <meta name="robots" content="nofollow" />{%endif%}
 {% if canonical_version %}
   <link rel="canonical" href="https://www.postgresql.org/docs/{{ canonical_version }}/{{ page.file }}" />
 {% endif %}
-  <link href="/media/css/fontawesome.css?{{gitrev}}" rel="stylesheet">
-  <link rel="stylesheet" href="/media/css/bootstrap-4.4.1.min.css">
-  <link rel="shortcut icon" href="/favicon.ico" />
-  {%if newstags %}
-  {%comment%}Default RSS links are only shown on pages that have newstags set{%endcomment%}
-  <link rel="alternate" type="application/rss+xml" title="All PostgreSQL News" href="/news.rss" />
-  {%for t in newstags%}
-    <link rel="alternate" type="application/rss+xml" title="PostgreSQL News about {{t.name}}" href="/news/{{t.urlname}}.rss" />
-  {%endfor%}
-  <link rel="alternate" type="application/rss+xml" title="PostgreSQL Events" href="/events.rss" />
-  {%endif%}
-  <link rel="stylesheet" type="text/css" href="/dyncss/base.css?{{gitrev}}">
+{% endblock %}
 
-  <script src="/media/js/theme.js"></script>
-
-  {%block extrahead%}{%endblock%}
-  </head>
-  <body>
-    <div class="container-fluid">
-      <div class="row justify-content-md-center">
-        <div class="col">
-          <!-- Header -->
-          <nav class="navbar navbar-expand-lg navbar-light bg-light">
-            <a class="navbar-brand p-0" href="/">
-              <img class="logo" src="/media/img/about/press/elephant.png" alt="PostgreSQL Elephant Logo">
-            </a>
-            <input type="checkbox" id="navbar-toggler" aria-controls="pgNavbar" aria-expanded="false" aria-label="Toggle navigation">
-            <label for="navbar-toggler" id="navbar-toggler-label" class="navbar-toggler" tabindex="0"><span class="navbar-toggler-icon"></span></label>
-            <div class="navbar-collapse" id="pgNavbar">
-              <ul class="navbar-nav mr-auto">
-                <li class="nav-item p-2"><a href="/" title="Home">Home</a></li>
-                <li class="nav-item p-2"><a href="/about/" title="About">About</a></li>
-                <li class="nav-item p-2"><a href="/download/" title="Download">Download</a></li>
-                <li class="nav-item p-2"><a href="/docs/" title="Documentation">Documentation</a></li>
-                <li class="nav-item p-2"><a href="/community/" title="Community">Community</a></li>
-                <li class="nav-item p-2"><a href="/developer/" title="Developers">Developers</a></li>
-                <li class="nav-item p-2"><a href="/support/" title="Support">Support</a></li>
-                <li class="nav-item p-2"><a href="/about/donate/" title="Donate">Donate</a></li>
-                <li class="nav-item p-2"><a href="/account/" title="Your account">Your account</a></li>
-              </ul>
-              <form role="search" method="get" action="/search/">
-                <div class="input-group">
-                  <input id="q" name="q" type="text" size="20" maxlength="255" accesskey="s"  class="form-control" placeholder="Search for...">
-                  <span class="input-group-btn">
-                    <button class="btn btn-default" type="submit"><i class="fas fa-search"></i></button>
-                  </span>
-                </div><!-- /input-group -->
-              </form>
-              <form id="form-theme" class="form-inline d-none">
-                <button id="btn-theme" class="btn btn-default ml-1" type="button"></button>
-              </form>
-            </div>
-          </nav>
-        </div>
-      </div>
-      <div class="row justify-content-center pg-shout-box">
-        <div class="col text-white text-center">{%include "base/esi.html" with includepage="/include/topbar" %}</div>
-      </div>
-    </div>
+{% block layoutblock %}
     <div class="container-fluid margin">
       <div class="row">
         <div id="pgContentWrap" class="col-11">
         </div> <!-- pgContentWrap -->
       </div>
     </div>
-    <!-- Footer -->
-    <footer id="footer">
-      <!-- Copyright -->
-      <div class="container">
-        <a href="/about/privacypolicy">Privacy Policy</a> |
-        <a href="/about/policies/coc/">Code of Conduct</a> |
-        <a href="/about/">About PostgreSQL</a> |
-        <a href="/about/contact/">Contact</a><br/>
-        <p>Copyright &copy; 1996-{% now "Y" %} The PostgreSQL Global Development Group</p>
-      </div>
-    </footer>
-    <script src="/media/js/main.js?{{gitrev}}"></script>
-  </body>
-</html>
+{% endblock %}