You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@annotator.apache.org by ge...@apache.org on 2021/05/15 12:12:21 UTC

[incubator-annotator-website] branch asf-site updated: Tweak layout, change navigation menu, …

This is an automated email from the ASF dual-hosted git repository.

gerben pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/incubator-annotator-website.git


The following commit(s) were added to refs/heads/asf-site by this push:
     new 8d9d7fb  Tweak layout, change navigation menu, …
8d9d7fb is described below

commit 8d9d7fbb60df2e48d42fd2027a1b40765c81ff65
Author: Gerben <ge...@treora.com>
AuthorDate: Sun May 9 23:09:08 2021 +0200

    Tweak layout, change navigation menu, …
---
 src/_includes/docs_nav.hbs          | 11 +++++
 src/_includes/page_footer.hbs       |  4 ++
 src/_includes/page_header.hbs       | 17 +++++---
 src/_layouts/default.hbs            | 18 ++++++--
 src/_layouts/docs.hbs               | 22 ++++------
 src/docs/getting-started.md         |  1 +
 src/docs/index.md                   |  3 +-
 typedoc_theme/layouts/default.hbs   | 85 ++++++++++++++++++++++++-------------
 typedoc_theme/partials/docs_nav.hbs |  1 +
 9 files changed, 106 insertions(+), 56 deletions(-)

diff --git a/src/_includes/docs_nav.hbs b/src/_includes/docs_nav.hbs
new file mode 100644
index 0000000..c25703b
--- /dev/null
+++ b/src/_includes/docs_nav.hbs
@@ -0,0 +1,11 @@
+{{!--
+  This template is used both in our TypeDoc theme (for API reference) and in 11ty (for the rest of the site).
+  Therefore: only use plain Handlebars code, no custom helpers etc.
+--}}
+<nav class="ui secondary stackable pointing menu" style="justify-content: center;">
+  <a href="/docs/" class="{{#if isDocsIndex}}active {{/if}}item">Overview</a>
+  <a href="/docs/getting-started" class="{{#if isGettingStarted}}active {{/if}}item">Getting Started</a>
+  <div class="ui secondary menu">
+    <a href="/docs/api/" class="{{#if isApiReference}}active {{/if}}item">API reference</a>
+  </div>
+</nav>
diff --git a/src/_includes/page_footer.hbs b/src/_includes/page_footer.hbs
index 7cd2ea5..5a256b3 100644
--- a/src/_includes/page_footer.hbs
+++ b/src/_includes/page_footer.hbs
@@ -1,3 +1,7 @@
+{{!--
+  This template is used both in our TypeDoc theme (for API reference) and in 11ty (for the rest of the site).
+  Therefore: only use plain Handlebars code, no custom helpers etc.
+--}}
     <footer class="ui bottom attached segment">
       <div class="ui container">
         <div class="ui equal height divided stackable grid">
diff --git a/src/_includes/page_header.hbs b/src/_includes/page_header.hbs
index efbe186..eda0926 100644
--- a/src/_includes/page_header.hbs
+++ b/src/_includes/page_header.hbs
@@ -1,16 +1,19 @@
+{{!--
+  This template is used both in our TypeDoc theme (for API reference) and in 11ty (for the rest of the site).
+  Therefore: only use plain Handlebars code, no custom helpers etc.
+--}}
     <div class="ui borderless stackable top attached main menu">
       <div class="ui container">
         <a class="item" href="/" style="color: rgba(0,0,0,.87);">
           <img class="ui small image" src="/images/annotator-logo.svg" alt="Apache Annotator (incubating)" />
         </a>
 
-        <div class="right menu">
+        <nav class="right menu">
+          <a class="{{#if isHome}}active {{/if}}item" href="/">Home</a>
           <a class="item" href="/demo/"><span class="ui positive button">Demo!</span></a>
-          <a class="item" rel="external" href="https://www.npmjs.com/package/apache-annotator">NPM</a>
-          <a class="item" rel="external" href="https://github.com/apache?q=annotator#org-repositories">Code</a>
-          <a class="item" rel="external" href="https://github.com/apache/incubator-annotator/issues">Issues</a>
-          <a class="{{#if isDocs}}active {{/if}}item" href="/docs/">Docs</a>
-          <a class="item" rel="external" href="https://mail-archives.apache.org/mod_mbox/incubator-annotator-dev/">Mailing List</a>
-        </div>
+          <a class="{{#if isDocs}}active {{/if}}item" href="/docs/">Documentation</a>
+          <a class="item" rel="external" href="https://github.com/apache/incubator-annotator">Code&nbsp;<i class="small external icon"></i></a>
+          <a class="item" rel="external" href="https://github.com/apache/incubator-annotator/issues">Issue tracker&nbsp;<i class="small external icon"></i></a>
+        </nav>
       </div>
     </div>
diff --git a/src/_layouts/default.hbs b/src/_layouts/default.hbs
index 56c2f1b..b5d039f 100644
--- a/src/_layouts/default.hbs
+++ b/src/_layouts/default.hbs
@@ -1,5 +1,9 @@
+{{!--
+  This template is used both in our TypeDoc theme (for API reference) and in 11ty (for the rest of the site).
+  Therefore: only use plain Handlebars code, no custom helpers etc.
+--}}
 <!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns#">
+<html prefix="og: http://ogp.me/ns#" class="default">
   <head>
     <meta charset="utf-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
@@ -22,16 +26,22 @@
 
     <link rel="alternate" title="DOAP" href="doap.rdf" type="application/rdf+xml" />
 
+    {{#> extra_head_stuff }}
+      {{!--
+        Our TypeDoc theme puts its stylesheets and scripts here.
+        Note Semantic-UI must be after this to override font size etc.
+      --}}
+    {{/extra_head_stuff}}
+
     <link rel="stylesheet" href="//semantic-ui.com/dist/semantic.min.css" />
   </head>
 
   <body>
     {{> page_header}}
     <div class="ui basic segment container">
-      {{!-- This template is used both in our TypeDoc theme, and in 11ty --}}
-      {{!-- For TypeDoc, we get the content as a handlebars partial block --}}
+      {{!-- For TypeDoc, we get the content as a Handlebars partial block --}}
       {{#> @partial-block}}
-        {{!-- For 11ty, we get the content as a variable --}}
+        {{!-- For 11ty, we get the content as a variable, so that’s our ‘fallback’ code for the partial block --}}
         {{{content}}}
       {{/@partial-block}}
     </div>
diff --git a/src/_layouts/docs.hbs b/src/_layouts/docs.hbs
index 0aacde4..ee9f3d3 100644
--- a/src/_layouts/docs.hbs
+++ b/src/_layouts/docs.hbs
@@ -2,17 +2,11 @@
 layout: default
 isDocs: true
 ---
-      <div class="ui grid">
-        <div class="three wide column">
-          <div class="ui vertical secondary menu">
-            {{#each collections.all}}
-            {{#if (not-eq this.url '/')}}
-            <div class="{{#if (eq ../page.url this.url)}}active {{/if}}item"><a href="{{this.url}}">{{this.data.title}}</a></div>
-            {{/if}}
-            {{/each}}
-          </div>
-        </div>
-        <div class="nine wide column">
-          {{{content}}}
-        </div>
-      </div>
+
+{{> docs_nav }}
+
+<main class="ui basic segment container">
+  <h1>{{title}}</h1>
+
+  {{{content}}}
+</main>
diff --git a/src/docs/getting-started.md b/src/docs/getting-started.md
index 3643292..5941fd3 100644
--- a/src/docs/getting-started.md
+++ b/src/docs/getting-started.md
@@ -1,5 +1,6 @@
 ---
 title: Getting Started
+isGettingStarted: true
 layout: docs
 ---
 
diff --git a/src/docs/index.md b/src/docs/index.md
index 528b88f..7101932 100644
--- a/src/docs/index.md
+++ b/src/docs/index.md
@@ -1,5 +1,6 @@
 ---
-title: Documentation
+title: Overview
+isDocsIndex: true
 layout: docs
 ---
 
diff --git a/typedoc_theme/layouts/default.hbs b/typedoc_theme/layouts/default.hbs
index fd92fa5..04dc109 100644
--- a/typedoc_theme/layouts/default.hbs
+++ b/typedoc_theme/layouts/default.hbs
@@ -1,38 +1,63 @@
 {{#> website_default isDocs=true}}
-  <link rel="stylesheet" href="{{relativeURL "assets/css/main.css"}}">
-  <script async src="{{relativeURL "assets/js/search.js"}}" id="search-script"></script>
-
-  <aside>
+  {{#*inline "extra_head_stuff"}}
+    <link rel="stylesheet" href="{{relativeURL "assets/css/main.css"}}">
     <style>
-      #tsd-search {
-        position: relative;
-      }
-      #tsd-search input {
-        border: 1px solid grey;
-        border-radius: 2px;
-        padding: 0.2em;
-      }
-      #tsd-search .results {
-        z-index: 1;
-        position: absolute;
+      /* Avoid TypeDoc style messing up the page around it. Why oh why did scoped CSS die? */
+      .ui.container {
+        padding: unset;
       }
     </style>
-    {{> typedoc_search_widget}}
-  </aside>
+    <script async src="{{relativeURL "assets/js/search.js"}}" id="search-script"></script>
+    <script defer src="{{relativeURL "assets/js/main.js"}}"></script>
+  {{/inline}}
 
-  <header style="margin: 2em 0;" id="typedoc-title">
-    <style>
-      #typedoc-title h1 {
-        margin-top: 0;
-      }
-    </style>
-    {{> typedoc_breadcrumbs}}
-    {{> typedoc_h1_title}}
-  </header>
+  {{> docs_nav isApiReference=true}}
 
-  <main>
-    {{> typedoc_main_content }}
-  </main>
+  <div class="ui basic segment container">
+    <div class="ui stackable grid">
+      <div class="eight wide column">
+        <h1>
+          API reference
+        </h1>
+      </div>
+      <div class="eight wide column">
+        <aside>
+          <style>
+            #tsd-search {
+              position: relative;
+              text-align: right;
+            }
+            #tsd-search input {
+              border: 1px solid grey;
+              border-radius: 4px;
+              padding: 0.4em;
+            }
+            #tsd-search label,
+            #tsd-search label::before,
+            #tsd-search input {
+              vertical-align: middle;
+            }
+            #tsd-search .results {
+              z-index: 1;
+              position: absolute;
+              box-shadow: 0px 20px 20px #00000066;
+            }
+          </style>
+          {{> typedoc_search_widget}}
+        </aside>
+      </div>
+    </div>
 
-  <script src="{{relativeURL "assets/js/main.js"}}"></script>
+    <header style="margin: 2em 0;" id="typedoc-title">
+      <style>
+        #typedoc-title h1 {
+          margin-top: 0;
+        }
+      </style>
+      {{> typedoc_breadcrumbs}}
+      {{> typedoc_h1_title}}
+    </header>
+
+    {{> typedoc_main_content }}
+  </div>
 {{/website_default}}
diff --git a/typedoc_theme/partials/docs_nav.hbs b/typedoc_theme/partials/docs_nav.hbs
new file mode 120000
index 0000000..c116873
--- /dev/null
+++ b/typedoc_theme/partials/docs_nav.hbs
@@ -0,0 +1 @@
+../../src/_includes/docs_nav.hbs
\ No newline at end of file