Browse Source

Utilities/Sphinx: Add OpenSearch link to html page headers on cmake.org

Reference an OpenSearch description file that sits outside the content
of any specific version so we only need to maintain one and so that
it can reference the latest version.

This was previously added in a custom branch for building the
cmake.org reference documentation.
Brad King 3 years ago
parent
commit
5c2e8ce515
2 changed files with 6 additions and 0 deletions
  1. 1 0
      Utilities/Sphinx/CMakeLists.txt
  2. 5 0
      Utilities/Sphinx/templates/layout.html

+ 1 - 0
Utilities/Sphinx/CMakeLists.txt

@@ -139,6 +139,7 @@ set(doc_html_opts "")
 if(CMake_SPHINX_CMAKE_ORG)
   list(APPEND doc_html_opts
     -A googleanalytics=1
+    -A opensearch=1
     -A versionswitch=1
     )
 

+ 5 - 0
Utilities/Sphinx/templates/layout.html

@@ -31,6 +31,11 @@
 {%- endblock %}
 
 {% block extrahead %}
+  {%- if opensearch is defined %}
+    <link rel="search" type="application/opensearchdescription+xml"
+          title="Search within CMake Documentation of Latest Version"
+          href="{{ pathto('../latest-opensearch.xml', 1) }}"/>
+  {%- endif %}
   {%- if versionswitch is defined %}
     <script type="text/javascript" src="{{ pathto('../version_switch.js', 1) }}"></script>
   {%- endif %}