templates.html 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1">
  6. <title>Work with the Handlebars Templates :: jMonkeyEngine Docs</title>
  7. <link rel="canonical" href="https://wiki.jmonkeyengine.org/wiki-ui/templates.html">
  8. <link rel="prev" href="development-workflow.html">
  9. <link rel="next" href="stylesheets.html">
  10. <meta name="generator" content="Antora 2.3.3">
  11. <link rel="stylesheet" href="../_/css/site.css">
  12. <meta property="og:image" content="https://wiki.jmonkeyengine.org/_/img/iconx128.png">
  13. <meta property="og:description" content="Work with the Handlebars Templates">
  14. <meta property="og:title" content="jMonkeyEngine Docs">
  15. <link rel="stylesheet" href="../_/css/site-extra.css">
  16. <link rel="stylesheet" href="../_/css/vendor/docsearch.min.css">
  17. <!-- fetched from https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css -->
  18. <link rel="icon" href="../_/img/favicon.ico" type="image/x-icon">
  19. </head>
  20. <body class="article">
  21. <header class="header">
  22. <nav class="navbar">
  23. <div class="navbar-brand">
  24. <a class="navbar-item" href="https://wiki.jmonkeyengine.org">
  25. <img alt="" src="../_/img/jMonkeyDocLogo.png" height="32" type="image/x-icon">
  26. </a>
  27. <div class="navbar-item hide-for-print">
  28. <input type="text" placeholder="Search docs..." id="search-input"/>
  29. </div>
  30. <button class="navbar-burger" data-target="topbar-nav">
  31. <span></span>
  32. <span></span>
  33. <span></span>
  34. </button>
  35. </div>
  36. <div id="topbar-nav" class="navbar-menu">
  37. <div class="navbar-end">
  38. <div class="navbar-item theme-switch-wrapper">
  39. <label class="theme-switch" for="checkbox">
  40. <input type="checkbox" id="checkbox" />
  41. <div class="slider round"></div>
  42. </label>
  43. </div>
  44. <a class="navbar-item" href="https://github.com/jmonkeyengine/wiki">Github</a>
  45. </div>
  46. </div>
  47. </nav>
  48. </header>
  49. <div class="body">
  50. <div class="nav-container" data-component="wiki-ui" data-version="master">
  51. <aside class="nav">
  52. <div class="panels">
  53. <div class="nav-panel-menu is-active" data-panel="menu">
  54. <nav class="nav-menu">
  55. <h3 class="title"><a href="index.html">Wiki UI</a></h3>
  56. <ul class="nav-list">
  57. <li class="nav-item" data-depth="0">
  58. <ul class="nav-list">
  59. <li class="nav-item" data-depth="1">
  60. <a class="nav-link" href="prerequisites.html">UI Development Prerequisites</a>
  61. </li>
  62. <li class="nav-item" data-depth="1">
  63. <a class="nav-link" href="set-up-project.html">Set up a UI Project</a>
  64. </li>
  65. <li class="nav-item" data-depth="1">
  66. <a class="nav-link" href="build-preview-ui.html">Build and Preview the UI</a>
  67. </li>
  68. <li class="nav-item" data-depth="1">
  69. <a class="nav-link" href="development-workflow.html">UI Development Workflow</a>
  70. </li>
  71. <li class="nav-item is-current-page" data-depth="1">
  72. <a class="nav-link" href="templates.html">Work with the Handlebars Templates</a>
  73. </li>
  74. <li class="nav-item" data-depth="1">
  75. <button class="nav-item-toggle"></button>
  76. <a class="nav-link" href="stylesheets.html">Work with the CSS Stylesheets</a>
  77. <ul class="nav-list">
  78. <li class="nav-item" data-depth="2">
  79. <a class="nav-link" href="add-fonts.html">Add Fonts</a>
  80. </li>
  81. </ul>
  82. </li>
  83. <li class="nav-item" data-depth="1">
  84. <button class="nav-item-toggle"></button>
  85. <a class="nav-link" href="style-guide.html">UI Element Styles</a>
  86. <ul class="nav-list">
  87. <li class="nav-item" data-depth="2">
  88. <a class="nav-link" href="inline-text-styles.html">Inline Text</a>
  89. </li>
  90. <li class="nav-item" data-depth="2">
  91. <a class="nav-link" href="admonition-styles.html">Admonitions</a>
  92. </li>
  93. <li class="nav-item" data-depth="2">
  94. <a class="nav-link" href="list-styles.html">Lists</a>
  95. </li>
  96. <li class="nav-item" data-depth="2">
  97. <a class="nav-link" href="sidebar-styles.html">Sidebars</a>
  98. </li>
  99. <li class="nav-item" data-depth="2">
  100. <a class="nav-link" href="ui-macro-styles.html">UI Macros</a>
  101. </li>
  102. </ul>
  103. </li>
  104. </ul>
  105. </li>
  106. </ul>
  107. </nav>
  108. </div>
  109. <div class="nav-panel-explore" data-panel="explore">
  110. <div class="context">
  111. <span class="title">Wiki UI</span>
  112. <span class="version">master</span>
  113. </div>
  114. <ul class="components">
  115. <li class="component">
  116. <span class="title">Docs</span>
  117. <ul class="versions">
  118. <li class="version is-latest">
  119. <a href="../docs/documentation.html">master</a>
  120. </li>
  121. </ul>
  122. </li>
  123. <li class="component is-current">
  124. <span class="title">Wiki UI</span>
  125. <ul class="versions">
  126. <li class="version is-current is-latest">
  127. <a href="index.html">master</a>
  128. </li>
  129. </ul>
  130. </li>
  131. </ul>
  132. </div>
  133. </div>
  134. </aside>
  135. </div>
  136. <main class="article">
  137. <div class="toolbar" role="navigation">
  138. <button class="nav-toggle"></button>
  139. <nav class="breadcrumbs" aria-label="breadcrumbs">
  140. <ul>
  141. <li><a href="index.html">Wiki UI</a></li>
  142. <li><a href="templates.html">Work with the Handlebars Templates</a></li>
  143. </ul>
  144. </nav>
  145. <div class="edit-this-page"><a href="https://github.com/jMonkeyEngine/wiki-ui/edit/master/docs/modules/ROOT/pages/templates.adoc">Edit this Page</a></div>
  146. </div>
  147. <div class="content">
  148. <article class="doc">
  149. <h1 class="page">Work with the Handlebars Templates</h1>
  150. <div id="preamble">
  151. <div class="sectionbody">
  152. <div class="paragraph">
  153. <p>Antora combines the Handlebars templates with the converted AsciiDoc content and other UI model data to make the pages in the site.
  154. These &#8220;logic-less&#8221; templates are mostly HTML with some special mustache tags sprinkled in where content should be inserted.</p>
  155. </div>
  156. </div>
  157. </div>
  158. <div class="sect1">
  159. <h2 id="what-do-the-templates-do"><a class="anchor" href="#what-do-the-templates-do"></a>What do the templates do?</h2>
  160. <div class="sectionbody">
  161. <div class="paragraph">
  162. <p>The layout templates, which are stored in <em class="path">src/layouts/</em>, provide the main page structure.
  163. The partial templates, in <em class="path">src/partials/</em>, fill in different regions of a page, such as the navigation and footer.</p>
  164. </div>
  165. <div class="paragraph">
  166. <p>The templates read from a model that&#8217;s populated by Antora.
  167. The model can be accessed by enclosing path expressions in mustaches, which are <code>{{</code> and <code>}}</code> or <code>{{{</code> and <code>}}}</code> (e.g., <code>{{{page.title}}}</code>).
  168. The double mustaches escape the value for HTML, whereas triple mustaches insert the value as is.</p>
  169. </div>
  170. <div class="admonitionblock warning">
  171. <table>
  172. <tr>
  173. <td class="icon">
  174. <i class="fa icon-warning" title="Warning"></i>
  175. </td>
  176. <td class="content">
  177. If the mustaches are preceded by a backslash (e.g, <code>\{{</code>), the expression will be disabled.
  178. This often comes up when constructing URLs.
  179. To avoid this problem, you should use forward slashes in URLs instead of backslashes.
  180. </td>
  181. </tr>
  182. </table>
  183. </div>
  184. <div class="paragraph">
  185. <p>When <code>{{</code> is immediately followed by <code>&gt;</code>, that invokes a partial (from the partials directory) and inserts the result (e.g., <code>{{&gt; head}}</code>.
  186. In other words, that&#8217;s not a model reference like the other mustache expressions.</p>
  187. </div>
  188. <div class="sect2">
  189. <h3 id="template-variables"><a class="anchor" href="#template-variables"></a>Template variables</h3>
  190. <div class="admonitionblock caution">
  191. <table>
  192. <tr>
  193. <td class="icon">
  194. <i class="fa icon-caution" title="Caution"></i>
  195. </td>
  196. <td class="content">
  197. This model is not final.
  198. Variable names and purposes may change.
  199. </td>
  200. </tr>
  201. </table>
  202. </div>
  203. <div class="paragraph">
  204. <p>Here&#8217;s an overview of the available UI model:</p>
  205. </div>
  206. <table id="template-variables-table" class="tableblock frame-all grid-all stretch">
  207. <caption class="title">Table 1. Variables available to the Handlebars templates (top-level variables in bold)</caption>
  208. <colgroup>
  209. <col style="width: 33.3333%;">
  210. <col style="width: 66.6667%;">
  211. </colgroup>
  212. <thead>
  213. <tr>
  214. <th class="tableblock halign-left valign-top">Name</th>
  215. <th class="tableblock halign-left valign-top">Description</th>
  216. </tr>
  217. </thead>
  218. <tbody>
  219. <tr>
  220. <td class="tableblock halign-left valign-top"><p class="tableblock"><strong><a id="site"></a>site</strong></p></td>
  221. <td class="tableblock halign-left valign-top"><p class="tableblock">Information about the site.</p></td>
  222. </tr>
  223. <tr>
  224. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>site.url</code></p></td>
  225. <td class="tableblock halign-left valign-top"><p class="tableblock">The base URL of the site, if specified in the playbook.</p></td>
  226. </tr>
  227. <tr>
  228. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>site.path</code></p></td>
  229. <td class="tableblock halign-left valign-top"><p class="tableblock">The pathname (i.e., subpath) of the site.url under which the site is hosted (e.g., /docs).
  230. This value is empty if site.url is not defined, has no path segment, or matches /.
  231. Can be removed from the site.url value using a helper (e.g., <code>deleteSuffix site.url site.path</code>)
  232. (since Antora 2.1)</p></td>
  233. </tr>
  234. <tr>
  235. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>site.title</code></p></td>
  236. <td class="tableblock halign-left valign-top"><p class="tableblock">The title of the site.</p></td>
  237. </tr>
  238. <tr>
  239. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>site.components</code></p></td>
  240. <td class="tableblock halign-left valign-top"><p class="tableblock">A map of all the components in the site, keyed by component name.
  241. Properties of each component include name, title, url, latest, and versions.
  242. Properties of each version include name (since 2.3), version, displayVersion, prerelease (if set), title, url, asciidoc (since 2.3), and navigation.
  243. The navigation property on each version provides access to the navigation menu for that component version.</p></td>
  244. </tr>
  245. <tr>
  246. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>site.ui</code></p></td>
  247. <td class="tableblock halign-left valign-top"><p class="tableblock">Information about the site UI.</p></td>
  248. </tr>
  249. <tr>
  250. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>site.ui.defaultLayout</code></p></td>
  251. <td class="tableblock halign-left valign-top"><p class="tableblock">The default page layout used for this site.</p></td>
  252. </tr>
  253. <tr>
  254. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>site.ui.url</code></p></td>
  255. <td class="tableblock halign-left valign-top"><p class="tableblock">The absolute base URL of the UI.</p></td>
  256. </tr>
  257. <tr>
  258. <td class="tableblock halign-left valign-top"><p class="tableblock"><strong><a id="page"></a>page</strong></p></td>
  259. <td class="tableblock halign-left valign-top"><p class="tableblock">Information about the current page.</p></td>
  260. </tr>
  261. <tr>
  262. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>page.title</code></p></td>
  263. <td class="tableblock halign-left valign-top"><p class="tableblock">The page title in HTML format (often used as the primary heading).
  264. This value may include inline HTML elements and XML character references.</p></td>
  265. </tr>
  266. <tr>
  267. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>page.contents</code></p></td>
  268. <td class="tableblock halign-left valign-top"><p class="tableblock">The main article content in HTML format.
  269. Sourced from AsciiDoc and converted to HTML by the Asciidoctor processor.</p></td>
  270. </tr>
  271. <tr>
  272. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>page.attributes</code></p></td>
  273. <td class="tableblock halign-left valign-top"><p class="tableblock">Any AsciiDoc document attribute prefixed with <code>page-</code>.
  274. The <code>page-</code> prefix is dropped from the name used in this model.
  275. For example, the value of the document attribute named <code>page-support-phone</code> can be accessed via the UI model using <code>page.attributes.support-phone</code>.
  276. Page attributes can be defined per page in the AsciiDoc document header (e.g., <code>:page-support-phone: +1 212-555-1234</code>) or globally in the playbook under the key <code>asciidoc.attributes</code>.
  277. The <code>page-</code> prefix is used to isolate page-related attributes from the numerous other document attributes in AsciiDoc.</p></td>
  278. </tr>
  279. <tr>
  280. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>page.description</code></p></td>
  281. <td class="tableblock halign-left valign-top"><p class="tableblock">The text of the description attribute in the AsciiDoc header, if specified.</p></td>
  282. </tr>
  283. <tr>
  284. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>page.keywords</code></p></td>
  285. <td class="tableblock halign-left valign-top"><p class="tableblock">A comma-separated list of keywords defined in the AsciiDoc header, if specified.</p></td>
  286. </tr>
  287. <tr>
  288. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>page.component</code></p></td>
  289. <td class="tableblock halign-left valign-top"><p class="tableblock">Information about the component for the current page.
  290. Properties include name, title, url, latest, and versions.</p></td>
  291. </tr>
  292. <tr>
  293. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>page.componentVersion</code></p></td>
  294. <td class="tableblock halign-left valign-top"><p class="tableblock">Information about the component version for the current page.
  295. Properties include name (since 2.3), version, displayVersion, prerelease (if set), title, url, and asciidoc (since 2.3).</p></td>
  296. </tr>
  297. <tr>
  298. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>page.module</code></p></td>
  299. <td class="tableblock halign-left valign-top"><p class="tableblock">The name of the module for the current page.</p></td>
  300. </tr>
  301. <tr>
  302. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>page.version</code></p></td>
  303. <td class="tableblock halign-left valign-top"><p class="tableblock">The name of the version for the current page.</p></td>
  304. </tr>
  305. <tr>
  306. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>page.displayVersion</code></p></td>
  307. <td class="tableblock halign-left valign-top"><p class="tableblock">The name of the display version for the current page.</p></td>
  308. </tr>
  309. <tr>
  310. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>page.versions</code></p></td>
  311. <td class="tableblock halign-left valign-top"><p class="tableblock">All versions of the current page, including the current page.
  312. Each entry has the properties url, string, and missing.</p></td>
  313. </tr>
  314. <tr>
  315. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>page.breadcrumbs</code></p></td>
  316. <td class="tableblock halign-left valign-top"><p class="tableblock">An array of breadcrumb items that represent the current selection in the navigation tree.
  317. Includes text-only and external items.</p></td>
  318. </tr>
  319. <tr>
  320. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>page.navigation</code></p></td>
  321. <td class="tableblock halign-left valign-top"><p class="tableblock">The hierarchical navigation menu for the component version of the current page.
  322. Each navigation item contains the property <code>content</code> as well as the optional properties <code>url</code> and (child) <code>items</code>.</p></td>
  323. </tr>
  324. <tr>
  325. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>page.url</code></p></td>
  326. <td class="tableblock halign-left valign-top"><p class="tableblock">The URL for the current page.
  327. This value is a root-relative path.
  328. It&#8217;s often used as the base URL to generate relative URLs from this page.</p></td>
  329. </tr>
  330. <tr>
  331. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>page.canonicalUrl</code></p></td>
  332. <td class="tableblock halign-left valign-top"><p class="tableblock">The canonical URL for the current page.
  333. The canonicalUrl is only set if site.url is set.
  334. If there are multiple versions of the component, the canonical URL is the qualified URL of the most recent version of the page (excluding any prerelease versions).
  335. If there&#8217;s only a single version of the component, the canonical URL is the qualified URL of the current page.</p></td>
  336. </tr>
  337. <tr>
  338. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>page.editUrl</code></p></td>
  339. <td class="tableblock halign-left valign-top"><p class="tableblock">The URL to edit the current page (typically a web-based editor on the git host).
  340. The only hosts supported right now are github.com, gitlab.com, pagure.io, and bitbucket.org.</p></td>
  341. </tr>
  342. <tr>
  343. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>page.origin.private</code></p></td>
  344. <td class="tableblock halign-left valign-top"><p class="tableblock">This value will be true if the repository requires authentication or the repository URL embeds credentials.
  345. In the default UI, if this value is <code>true</code>, the "Edit this Page" link is disabled.
  346. A quick way to force this property to be <code>true</code> (even if the repository is public) is to begin the content source URL in the playbook with empty credentials, as in <code>https://@</code>.
  347. Then, the "Edit the Page" link will not appear.</p></td>
  348. </tr>
  349. <tr>
  350. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>page.home</code></p></td>
  351. <td class="tableblock halign-left valign-top"><p class="tableblock">Indicates whether the current page is the home page of the site.</p></td>
  352. </tr>
  353. <tr>
  354. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>page.layout</code></p></td>
  355. <td class="tableblock halign-left valign-top"><p class="tableblock">The page layout for the current page.</p></td>
  356. </tr>
  357. <tr>
  358. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>page.next</code></p></td>
  359. <td class="tableblock halign-left valign-top"><p class="tableblock">The next reachable page in the navigation tree (skips past text-only and external items).</p></td>
  360. </tr>
  361. <tr>
  362. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>page.previous</code></p></td>
  363. <td class="tableblock halign-left valign-top"><p class="tableblock">The previous reachable page in the navigation tree (skips past text-only and external items).</p></td>
  364. </tr>
  365. <tr>
  366. <td class="tableblock halign-left valign-top"><p class="tableblock"><code>page.parent</code></p></td>
  367. <td class="tableblock halign-left valign-top"><p class="tableblock">The parent page in the navigation tree (skips past text-only and external items).</p></td>
  368. </tr>
  369. <tr>
  370. <td class="tableblock halign-left valign-top"><p class="tableblock"><strong>env</strong></p></td>
  371. <td class="tableblock halign-left valign-top"><p class="tableblock">The map of environment variables (sourced from <code>process.env</code>).</p></td>
  372. </tr>
  373. <tr>
  374. <td class="tableblock halign-left valign-top"><p class="tableblock"><strong>siteRootPath</strong></p></td>
  375. <td class="tableblock halign-left valign-top"><p class="tableblock">The relative path to the root of the published site.</p></td>
  376. </tr>
  377. <tr>
  378. <td class="tableblock halign-left valign-top"><p class="tableblock"><strong>uiRootPath</strong></p></td>
  379. <td class="tableblock halign-left valign-top"><p class="tableblock">The relative path to the root directory of the UI.</p></td>
  380. </tr>
  381. <tr>
  382. <td class="tableblock halign-left valign-top"><p class="tableblock"><strong>antoraVersion</strong></p></td>
  383. <td class="tableblock halign-left valign-top"><p class="tableblock">The version of Antora used to build the site (specifically the version of the @antora/page-composer package).</p></td>
  384. </tr>
  385. </tbody>
  386. </table>
  387. <div class="paragraph">
  388. <p>This model is likely to grow over time.</p>
  389. </div>
  390. </div>
  391. </div>
  392. </div>
  393. <div class="sect1">
  394. <h2 id="modify-a-template"><a class="anchor" href="#modify-a-template"></a>Modify a template</h2>
  395. <div class="sectionbody">
  396. <div class="paragraph">
  397. <p>Let&#8217;s consider the case when you want to add a new meta tag inside the HTML head.</p>
  398. </div>
  399. <div class="paragraph">
  400. <p>First, make sure you have set up the project and created a development branch.
  401. Next, open the file <em class="path">templates/partials/head.hbs</em> and add your tag.</p>
  402. </div>
  403. <div class="listingblock">
  404. <div class="content">
  405. <pre class="highlightjs highlight"><code class="language-html hljs" data-lang="html">&lt;meta class="swiftype" name="title" data-type="string" content="{{page.title}}"&gt;</code></pre>
  406. </div>
  407. </div>
  408. <div class="paragraph">
  409. <p>Each template file has access to the template model, which exposes information about the current page through variable names.
  410. The variables currently available are listed in <a href="#template-variables-table">Variables available to the Handlebars templates (top-level variables in bold)</a>.</p>
  411. </div>
  412. <div class="paragraph">
  413. <p>Save the file, commit it to git, push the branch, and allow the approval workflow to play out.</p>
  414. </div>
  415. </div>
  416. </div>
  417. <nav class="pagination">
  418. <span class="prev"><a href="development-workflow.html">UI Development Workflow</a></span>
  419. <span class="next"><a href="stylesheets.html">Work with the CSS Stylesheets</a></span>
  420. </nav>
  421. </article>
  422. <aside class="toc sidebar" data-title="Contents" data-levels="2">
  423. <div class="toc-menu"></div>
  424. </aside>
  425. </div>
  426. </main>
  427. </div>
  428. <footer class="footer">
  429. <p>Copyright 2020 jMonkeyEngine Wiki Contributors. Licensed BSD-3.</p>
  430. </footer>
  431. <script src="../_/js/vendor/docsearch.min.js"></script>
  432. <!-- fetched from https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js -->
  433. <script>
  434. var search = docsearch({
  435. apiKey: 'a736b6d93de805e26ec2f49b55013fbd',
  436. indexName: 'jmonkeyengine',
  437. inputSelector: '#search-input',
  438. autocompleteOptions: { hint: false, keyboardShortcuts: ['s'] },
  439. algoliaOptions: { hitsPerPage: 10 }
  440. }).autocomplete
  441. search.on('autocomplete:closed', function () { search.autocomplete.setVal() })
  442. function focusSearchInput () { document.querySelector('#search-input').focus() }
  443. if (document.querySelector('.home-link.is-current')) window.addEventListener('load', focusSearchInput)
  444. </script>
  445. <script src="../_/js/site.js"></script>
  446. <script async src="../_/js/vendor/highlight.js"></script>
  447. </body>
  448. </html>